public ActionResult Edit(Guid id) { var item = ServiceLocator.ReportDatabase.GetById(id); var model = new ModelsItemDto() { Description = item.Description, From = item.From, Id = item.Id, Title = item.Title, To = item.To, Version = item.Version }; return(View(model)); }
public ActionResult Edit(ModelsItemDto item) { try { ServiceLocator.CommandBus.Send(new ChangeItemCommand(item.Id, item.Title, item.Description, item.From, item.To, item.Version)); } catch (ConcurrencyException err) { ViewBag.error = err.Message; ModelState.AddModelError("", err.Message); return(View()); } return(RedirectToAction("Index")); }
public ActionResult Add(ModelsItemDto item) { ServiceLocator.CommandBus.Send(new CreateItemCommand(Guid.NewGuid(), item.Title, item.Description, -1, item.From, item.To)); return(RedirectToAction("Index")); }