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 TopicTypePromotionController : Controller { //private readonly ITopicTypeQuery _topicTypeQuery; //private readonly IManagementTopicTypePromotionService _managementTopicTypePromotionService; //public static readonly int TopicTypePromotionMinDisplayCount = 2; //public TopicTypePromotionController(IManagementTopicTypePromotionService managementTopicTypePromotionService, ITopicTypeQuery topicTypeQuery) //{ // _managementTopicTypePromotionService = managementTopicTypePromotionService; // _topicTypeQuery = topicTypeQuery; //} //[HttpGet] //[ClaimsAuthorize(FhtUserClaimType.TopicTypePromotionList)] //public ActionResult List(string keyword = "", int pageIndex = 1, int pageSize = 10) //{ // var topicTypeList = _topicTypeQuery.GetTopicTypes(false); // List list = _managementTopicTypePromotionService.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 = _managementTopicTypePromotionService.GetListRowCountByKeyword(keyword); // return View(data); //} //[HttpGet] //[ClaimsAuthorize(FhtUserClaimType.TopicTypePromotionList)] //public ActionResult Create() //{ // var topicTypeList = _topicTypeQuery.GetTopicTypes(false); // ViewBag.TopicTypeList = topicTypeList; // return View(); //} //[HttpPost] //[ClaimsAuthorize(FhtUserClaimType.TopicTypePromotionList)] //[ValidateAntiForgeryToken] //public ActionResult Create(TopicTypePromotionInputModel inputItem) //{ // if (!ModelState.IsValid) // { // return View(inputItem); // } // else // { // inputItem.WebIconUrl = ImageConverter.ToRelativeUrl(inputItem.WebIconUrl); // _managementTopicTypePromotionService.Create(inputItem); // return RedirectToAction(nameof(List)); // } //} //[HttpGet] //[ClaimsAuthorize(FhtUserClaimType.TopicTypePromotionList)] //public ActionResult Edit(int ID) //{ // var topicTypeList = _topicTypeQuery.GetTopicTypes(false); // ViewBag.TopicTypeList = topicTypeList; // TopicTypePromotionEditViewModel data = _managementTopicTypePromotionService.GetForEditByID(ID); // data.WebIconUrl = ImageConverter.ToAbsoluteUrl(data.WebIconUrl, Core.CommonTypes.ImageSizeType.Thumbnail100whFill); // return View(data); //} //[HttpPost] //[ClaimsAuthorize(FhtUserClaimType.TopicTypePromotionList)] //[ValidateAntiForgeryToken] //public ActionResult Edit(TopicTypePromotionInputModel updateItem) //{ // if (!ModelState.IsValid) // { // return View(new TopicTypePromotionInputModel // { // 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); // _managementTopicTypePromotionService.Update(updateItem); // return RedirectToAction(nameof(List)); // } //} //[HttpPost] //[ClaimsAuthorize(FhtUserClaimType.TopicTypePromotionList)] //public ActionResult Delete(int id) //{ // _managementTopicTypePromotionService.DeleteByID(id); // return Json(new { Tip = "删除成功!" }, JsonRequestBehavior.AllowGet); //} } }