public ActionResult Save(SeedViewModel input) { Seed seed = input.Seed.EntityId > 0 ? _repository.Find<Seed>(input.Seed.EntityId) : new Seed(); mapItem(seed, input); var crudManager = _saveEntityService.ProcessSave(seed); var notification = crudManager.Finish(); return Json(notification, JsonRequestBehavior.AllowGet); }
public ActionResult AddEdit(ViewModel input) { var seed = input.EntityId > 0 ? _repository.Find<Seed>(input.EntityId) : new Seed(); var model = new SeedViewModel { Seed = seed }; return PartialView("SeedAddUpdate", model); }
public ActionResult Display(ViewModel input) { var seed = _repository.Find<Seed>(input.EntityId); var model = new SeedViewModel { Seed = seed, AddEditUrl = UrlContext.GetUrlForAction<SeedController>(x => x.AddEdit(null)) + "/" + seed.EntityId }; return PartialView("SeedView", model); }
private void mapItem(Seed seed, SeedViewModel input) { seed.Description = input.Seed.Description; seed.Name = input.Seed.Name; seed.Notes = input.Seed.Notes; }