using FHT.Agency.CommonTypes; using FHT.Agency.Web.Filters; using FHT.Core.UI.InputModels.Search; using FHT.Management.Interfaces.DependentInterfaces.Services; using FHT.Management.Interfaces.InputModels; using Microsoft.AspNet.Identity; using System.Net; using System.Threading.Tasks; using System.Web.Mvc; namespace FHT.Agency.Web.Areas.Manage.Controllers { [Authorize] public class FeedBackController : Controller { private readonly IManagementFeedbackService _managementFeedbackService; public FeedBackController(IManagementFeedbackService managementFeedbackService) { _managementFeedbackService = managementFeedbackService; } [HttpGet] [ClaimsAuthorize(FhtUserClaimType.FeedBack)] public async Task< ActionResult> Index(FeedBackFilterableInputModel args) { ViewBag.FeedBacks =await _managementFeedbackService.SearchAsync(args.UserId, args.IsDeal, args.Title, args.Limit, args.Offset()); return View(args); } [HttpGet] [ClaimsAuthorize(FhtUserClaimType.FeedBack)] public async Task Detail(long feedBackId) { Management.Interfaces.ViewModels.FeedbackViewModel model =await _managementFeedbackService.GetDetailAsync(feedBackId); if(model== null) { return new HttpStatusCodeResult(HttpStatusCode.NotFound); } ViewBag.FeedBack = model; return View(new FeedbackDealInputModel { FeedBackId = model.FeedBackId, Reply=model.Reply }); } [HttpPost] [ClaimsAuthorize(FhtUserClaimType.FeedBack)] [ValidateAjaxModel] public async Task Deal(FeedbackDealInputModel model) { int operatorId = User.Identity.GetUserId(); await _managementFeedbackService.ReplyAsync(operatorId,model); return Json(true,JsonRequestBehavior.AllowGet); } } }