From 8839b54dd35634e9e6d1f2d0a9100508e3cd030f Mon Sep 17 00:00:00 2001 From: mahan Date: Tue, 13 Jan 2026 10:31:41 +0330 Subject: [PATCH] add client api RewardController.cs --- .../Client/Controllers/RewardController.cs | 53 +++++++++++++++++++ 1 file changed, 53 insertions(+) create mode 100644 ServiceHost/Areas/Client/Controllers/RewardController.cs diff --git a/ServiceHost/Areas/Client/Controllers/RewardController.cs b/ServiceHost/Areas/Client/Controllers/RewardController.cs new file mode 100644 index 00000000..ae9b3611 --- /dev/null +++ b/ServiceHost/Areas/Client/Controllers/RewardController.cs @@ -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 GetList(RewardSearchModel searchModel) + { + searchModel.WorkshopId = _workshopId; + var res = _rewardApplication.GetSearchListAsGrouped(searchModel); + return res; + } + + [HttpPost] + public ActionResult Create(CreateRewardViewModel create) + { + create.WorkshopId = _workshopId; + return _rewardApplication.Create(create); + } + + [HttpPut] + public ActionResult Edit(EditRewardViewModel edit) + { + edit.WorkshopId = _workshopId; + return _rewardApplication.Edit(edit); + } + + [HttpDelete] + public ActionResult Delete(long id) + { + return _rewardApplication.Remove(id); + } + + [HttpGet("{id:long}")] + public ActionResult Details(long id) + { + return _rewardApplication.GetDetails(id); + } + +} \ No newline at end of file