public static void UpdateNewsPost(NewsPostEditModel editModel) { var newsPost = NewsPostService.GetNewsPost(editModel.Id); editModel.PassToNewsPost(newsPost); NewsPostService.UpdateNewsPost(newsPost); }
public ActionResult EditNews(NewsPostEditModel model) { if (ModelState.IsValid) { if (model.uploadFiles != null && model.uploadFiles[0] != null) { FileModelActions.RemoveFile(model.ImageId, Server); model.ImageId = FileModelActions.SaveFile(model.uploadFiles[0], Server); } if (model.Description == "<br>") { ModelState.AddModelError("Description", Language.Language.NoDescription); return(View(model)); } NewsPostHelper.UpdateNewsPost(model); return(RedirectToAction("Index")); } return(View(model)); }
public ActionResult EditNews(int id) { NewsPostEditModel newsPostAdminView = NewsPostHelper.GetNewsPostEditModel(id); return(View(newsPostAdminView)); }