public IActionResult Create(ENewsItemModel model, bool continueEditing) { if (ModelState.IsValid) { EnewsPaper newsItem = model.ToEntity <EnewsPaper>(); newsItem.CreateDate = DateTime.Now; newsItem.NewsPaperCategoryId = model.SelectedCategoryId; newsItem.PictureId = model.PictureId; _newsPaperServices.InsertNews(newsItem); string seName = _urlRecordService.ValidateSeName(newsItem, model.SeName, model.Name, true); _urlRecordService.SaveSlug(newsItem, seName); _eventPublisher.EntityInserted(newsItem); SuccessNotification("E-gazete Eklenidi"); _customerActivityService.InsertActivity(User.GetCustomer(_userManager, _customerService), "AddNewsPaper", "Yeni E-gazete Eklendi", newsItem); if (!continueEditing) { return(RedirectToAction("List")); } //selected tab SaveSelectedTabName(); return(RedirectToAction("Edit", new { id = newsItem.Id })); } return(RedirectToAction("List")); }
public IActionResult Edit(ENewsItemModel model, bool continueEditing) { EnewsPaper newsItem = _newsPaperServices.GetNewsByIdAs(model.Id); if (newsItem == null) { return(RedirectToAction("List")); } if (ModelState.IsValid) { newsItem = model.ToEntity <EnewsPaper>(); newsItem.CreateDate = DateTime.Now; newsItem.NewsPaperCategoryId = model.SelectedCategoryId; newsItem.PictureId = model.PictureId; _newsPaperServices.UpdateNews(newsItem); string seName = _urlRecordService.ValidateSeName(newsItem, model.SeName, model.Name, true); _urlRecordService.SaveSlug(newsItem, seName); //activity log _customerActivityService.InsertActivity("EditENewsPaper", string.Format("EditNewsPaper{0}", newsItem.Id), newsItem); //search engine name SuccessNotification("Güncelleme Yapıldı"); if (!continueEditing) { return(RedirectToAction("List")); } //selected tab SaveSelectedTabName(); return(RedirectToAction("Edit", new { id = newsItem.Id })); } return(RedirectToAction("List")); }