Compare commits
1 Commits
c2fdc217b9
...
Feature/re
| Author | SHA1 | Date | |
|---|---|---|---|
| 8839b54dd3 |
53
ServiceHost/Areas/Client/Controllers/RewardController.cs
Normal file
53
ServiceHost/Areas/Client/Controllers/RewardController.cs
Normal file
@@ -0,0 +1,53 @@
|
||||
using _0_Framework.Application;
|
||||
using CompanyManagment.App.Contracts.Reward;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using ServiceHost.BaseControllers;
|
||||
|
||||
namespace ServiceHost.Areas.Client.Controllers;
|
||||
|
||||
public class RewardController:ClientBaseController
|
||||
{
|
||||
private readonly IRewardApplication _rewardApplication;
|
||||
private readonly long _workshopId;
|
||||
|
||||
public RewardController(IRewardApplication rewardApplication, IAuthHelper authHelper)
|
||||
{
|
||||
_rewardApplication = rewardApplication;
|
||||
_workshopId = authHelper.GetWorkshopId();
|
||||
}
|
||||
|
||||
[HttpGet]
|
||||
public ActionResult<RewardsGroupedViewModel> GetList(RewardSearchModel searchModel)
|
||||
{
|
||||
searchModel.WorkshopId = _workshopId;
|
||||
var res = _rewardApplication.GetSearchListAsGrouped(searchModel);
|
||||
return res;
|
||||
}
|
||||
|
||||
[HttpPost]
|
||||
public ActionResult<OperationResult> Create(CreateRewardViewModel create)
|
||||
{
|
||||
create.WorkshopId = _workshopId;
|
||||
return _rewardApplication.Create(create);
|
||||
}
|
||||
|
||||
[HttpPut]
|
||||
public ActionResult<OperationResult> Edit(EditRewardViewModel edit)
|
||||
{
|
||||
edit.WorkshopId = _workshopId;
|
||||
return _rewardApplication.Edit(edit);
|
||||
}
|
||||
|
||||
[HttpDelete]
|
||||
public ActionResult<OperationResult> Delete(long id)
|
||||
{
|
||||
return _rewardApplication.Remove(id);
|
||||
}
|
||||
|
||||
[HttpGet("{id:long}")]
|
||||
public ActionResult<EditRewardViewModel> Details(long id)
|
||||
{
|
||||
return _rewardApplication.GetDetails(id);
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user