public IActionResult EditSetting( [Bind(nameof(EditSettingModel.Id), nameof(EditSettingModel.Title), nameof(EditSettingModel.imageFile), nameof(EditSettingModel.Description))] EditSettingModel model) { if (ModelState.IsValid) { try { model.Edit(); model.Response = new ResponseModel("Setting creation successful.", ResponseType.Success); return(RedirectToAction("Index")); } catch (DuplicationException ex) { model.Response = new ResponseModel(ex.Message, ResponseType.Failure); // error logger code } catch (Exception ex) { model.Response = new ResponseModel("Setting creation failued.", ResponseType.Failure); // error logger code } } return(View(model)); }
public IActionResult EditSetting(int id) { var model = new EditSettingModel(); model.Load(id); return(View(model)); }