using System.Collections.Generic; using System.Linq; using System.Web.Mvc; using Webdiyer.WebControls.Mvc; using FHT.Agency.Web.Filters; using FHT.Agency.CommonTypes; using FHT.Utilities; using FHT.Core.Queries.ImplementedInterfaces; using FHT.Management.Interfaces.InputModels; using FHT.Management.Interfaces.DependentInterfaces.Services; using FHT.Management.Interfaces.ViewModels; namespace FHT.Agency.Web.Areas.Manage.Controllers { public class TopicTypeProductPromotionController : Controller { //private readonly IManagementTopicTypeProductPromotionService _managementTopicTypeProductPromotionService; //private readonly ITopicTypeQuery _topicTypeQuery; //public static readonly int TopicTypeProductPromotionMinDisplayCount = 6; //public TopicTypeProductPromotionController(IManagementTopicTypeProductPromotionService managementTopicTypeProductPromotionService, ITopicTypeQuery topicTypeQuery) //{ // _managementTopicTypeProductPromotionService = managementTopicTypeProductPromotionService; // _topicTypeQuery = topicTypeQuery; //} //[HttpGet] //[ClaimsAuthorize(FhtUserClaimType.TopicTypeProductPromotionList)] //public ActionResult List(string keyword = "", int pageIndex = 1, int pageSize = 10) //{ // var topicTypeList = _topicTypeQuery.GetTopicTypes(false); // List list = _managementTopicTypeProductPromotionService.GetListByKeyword(keyword, pageIndex, pageSize); // foreach (var item in list) // { // item.WebIconUrl = ImageConverter.ToAbsoluteUrl(item.WebIconUrl,Core.CommonTypes.ImageSizeType.Thumbnail100whFill); // var topicType = topicTypeList.FirstOrDefault(k => k.TopicTypeId == item.TopicTypeId); // if (topicType != null) // { // item.TopicTypeName = topicType.Name; // } // } // var data = list.ToPagedList(pageIndex, pageSize); // data.CurrentPageIndex = pageIndex; // data.TotalItemCount = _managementTopicTypeProductPromotionService.GetListRowCountByKeyword(keyword); // return View(data); //} //[HttpGet] //[ClaimsAuthorize(FhtUserClaimType.TopicTypeProductPromotionList)] //public ActionResult Create() //{ // var topicTypeList = _topicTypeQuery.GetTopicTypes(false); // ViewBag.TopicTypeList = topicTypeList; // return View(); //} //[HttpPost] //[ClaimsAuthorize(FhtUserClaimType.TopicTypeProductPromotionList)] //[ValidateAntiForgeryToken] //public ActionResult Create(TopicTypeProductPromotionCreateInputModel inputItem) //{ // if (!ModelState.IsValid) // { // return View(inputItem); // } // else // { // inputItem.WebIconUrl = ImageConverter.ToRelativeUrl(inputItem.WebIconUrl); // _managementTopicTypeProductPromotionService.Create(inputItem); // return RedirectToAction(nameof(List)); // } //} //[HttpGet] //[ClaimsAuthorize(FhtUserClaimType.TopicTypeProductPromotionList)] //public ActionResult Edit(int ID) //{ // var topicTypeList = _topicTypeQuery.GetTopicTypes(false); // ViewBag.TopicTypeList = topicTypeList; // TopicTypeProductPromotionEditViewModel data = _managementTopicTypeProductPromotionService.GetForEditByID(ID); // data.WebIconUrl = ImageConverter.ToAbsoluteUrl(data.WebIconUrl, Core.CommonTypes.ImageSizeType.Thumbnail100whFill); // return View(data); //} //[HttpPost] //[ClaimsAuthorize(FhtUserClaimType.TopicTypeProductPromotionList)] //[ValidateAntiForgeryToken] //public ActionResult Edit(TopicTypeProductPromotionInputModel updateItem) //{ // if (!ModelState.IsValid) // { // return View(new TopicTypeProductPromotionEditViewModel // { // ID = updateItem.ID, // Title = updateItem.Title, // Description = updateItem.Description, // LinkUrl = updateItem.LinkUrl, // IsActive = updateItem.IsActive, // SortIndex = updateItem.SortIndex, // WebIconUrl = updateItem.WebIconUrl, // TopicTypeId = updateItem.TopicTypeId, // }); // } // else // { // updateItem.WebIconUrl =ImageConverter.ToRelativeUrl(updateItem.WebIconUrl); // _managementTopicTypeProductPromotionService.Update(updateItem); // return RedirectToAction(nameof(List)); // } //} //[HttpPost] //[ClaimsAuthorize(FhtUserClaimType.TopicTypeProductPromotionList)] //public ActionResult Delete(int ID) //{ // _managementTopicTypeProductPromotionService.DeleteByID(ID); // return Json(new { Tip = "删除成功!" }, JsonRequestBehavior.AllowGet); //} } }