public JsonResult Edit(DeerLickerViewModel model, int marketingYearId) { string message = String.Empty; try { _deerLickerService.UpdateDeerLicker(model, marketingYearId); } catch (Exception ex) { message = ex.Message; } return(Json(new { message }, JsonRequestBehavior.AllowGet)); }
public void UpdateDeerLicker(DeerLickerViewModel model, int marketingYearId) { if (model.Section <= 0 || model.District <= 0 || String.IsNullOrWhiteSpace(model.Forestry)) { throw new Exception("Wystąpił nieznany błąd podczas edytowania lizawek."); } var dto = new DeerLickerDto { Id = model.Id, Count = model.Count, Section = model.Section, District = model.District, Forestry = model.Forestry, Description = model.Description }; _deerLickerDao.Update(dto); }