public JsonResult Edit(PastureViewModel model, int marketingYearId) { string message = String.Empty; try { _pastureService.UpdatePasture(model, marketingYearId); } catch (Exception ex) { message = ex.Message; } return(Json(new { message }, JsonRequestBehavior.AllowGet)); }
public void AddPasture(PastureViewModel model, int marketingYearId) { if (model.Section <= 0 || model.District <= 0 || String.IsNullOrWhiteSpace(model.Forestry)) { throw new Exception("Wystąpił nieznany błąd podczas dodawania paśnika."); } var dto = new PastureDto { Section = model.Section, District = model.District, Forestry = model.Forestry, Description = model.Description, CreatedDate = model.CreatedDate, RemovedDate = model.RemovedDate }; _pastureDao.Insert(dto); }