public ActionResult RadarCategoryAdd(RadarCategory model, FormCollection parameters) { var exist = dbContextService.Exists <RadarCategory>(x => x.Name == model.Name); if (exist) { TempData["errorMsg"] = "该分类已存在!"; return(View()); } var normallogoFile = Request.Files[Request.Files.Keys[0]]; var hdlogoFile = Request.Files[Request.Files.Keys[1]]; var normallogoFilePath = GetNewsLogoFilePath <RadarCategory>(model, normallogoFile); var hdlogoFilePath = GetNewsLogoFilePath <RadarCategory>(model, hdlogoFile); if (!string.IsNullOrEmpty(normallogoFilePath)) { model.NormalLogoUrl = string.Format("{0}{1}", NEWS_LOGOS_IMAGE_PREFIX, Path.GetFileName(normallogoFilePath)); } if (!string.IsNullOrEmpty(hdlogoFilePath)) { model.HDLogoUrl = string.Format("{0}{1}", NEWS_LOGOS_IMAGE_PREFIX, Path.GetFileName(hdlogoFilePath)); } var ret = dbContextService.Add <RadarCategory>(model); RadarService.UpdateServerVersion <RadarCategory>(); return(RedirectToAction("RadarCategoryList")); }
public ActionResult RadarCategoryEdit(RadarCategory model, HttpPostedFileBase normallogoFile, HttpPostedFileBase hdlogoFile) { var radarCategory = dbContextService.Single <RadarCategory>(model.Id); radarCategory.Name = model.Name; radarCategory.Comment = model.Comment; radarCategory.Status = model.Status; radarCategory.CreateDateTime = DateTime.Now; var normallogoFilePath = GetNewsLogoFilePath <RadarCategory>(model, normallogoFile); var hdlogoFilePath = GetNewsLogoFilePath <RadarCategory>(model, hdlogoFile); if (!string.IsNullOrEmpty(normallogoFilePath)) { radarCategory.NormalLogoUrl = string.Format("{0}{1}", NEWS_LOGOS_IMAGE_PREFIX, Path.GetFileName(normallogoFilePath)); } if (!string.IsNullOrEmpty(hdlogoFilePath)) { radarCategory.HDLogoUrl = string.Format("{0}{1}", NEWS_LOGOS_IMAGE_PREFIX, Path.GetFileName(hdlogoFilePath)); } var ret = dbContextService.Update <RadarCategory>(radarCategory); RadarService.UpdateServerVersion <RadarCategory>(); return(RedirectToAction("RadarCategoryList")); }
public ActionResult RadarCategoryDelete(int radarCategoryId) { var ret = dbContextService.Delete <RadarCategory>(radarCategoryId); RadarService.UpdateServerVersion <RadarCategory>(); return(RedirectToAction("RadarCategoryList")); }
public ActionResult RadarElementDelete(int radarElementId) { var ret = dbContextService.Delete <RadarElement>(radarElementId); RadarService.UpdateServerVersion <RadarElement>(); return(RedirectToAction("RadarElementList")); }
public ActionResult RadarElementEdit(RadarElement model, FormCollection parameters) { var radarcategoryIds = parameters["radarcategory"].GetIds(); var radarElement = dbContextService.Single <RadarElement>(model.Id); radarElement.Name = model.Name; radarElement.RadarCategoryIds = radarcategoryIds.GetString(); radarElement.Comment = model.Comment; radarElement.Status = model.Status; radarElement.CreateDateTime = DateTime.Now; var ret = dbContextService.Update <RadarElement>(radarElement); RadarService.UpdateServerVersion <RadarElement>(); return(RedirectToAction("RadarElementList")); }
public ActionResult RadarElementAdd(RadarElement model, FormCollection parameters) { var radarcategoryIds = parameters["radarcategory"].GetIds(); var exist = dbContextService.Exists <RadarElement>(x => x.Name == model.Name); if (exist) { TempData["errorMsg"] = "该元素已存在!"; return(View()); } model.RadarCategoryIds = radarcategoryIds.GetString(); var ret = dbContextService.Add <RadarElement>(model); RadarService.UpdateServerVersion <RadarElement>(); return(RedirectToAction("RadarElementList")); }