public void SaveMainSliderContent(MainSliderContent entity) { if (entity.Image == null) { entity.Image = GetMainSliderContentByIdAsNoTracking(entity.Id).Image; } context.Entry(entity).State = EntityState.Modified; context.SaveChanges(); }
public IActionResult Edit(MainSliderContent model, IFormFile titleImageFile) { if (ModelState.IsValid) { var tupleExtImg = ImageValidator.ValidateImg(titleImageFile); if (tupleExtImg != default) { model.Extension = tupleExtImg.Item1; model.Image = tupleExtImg.Item2; } dataManager.MainSliderContent.SaveMainSliderContent(model); return(RedirectToAction(nameof(MainSliderContentController.EditMainSliderContent), nameof(MainSliderContentController).CutController())); } return(View(model)); }