public ActionResult Edit(Guid id) { var item = ServiceLocator.ReportDatabase.GetById(id); var model = new DiaryItemDto() { Description = item.Description, From = item.From, Id = item.Id, Title = item.Title, To = item.To, Version = item.Version }; return View(model); }
public ActionResult Edit(DiaryItemDto 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 void Add(DiaryItemDto item) { items.Add(item); }
public ActionResult Add(DiaryItemDto item) { ServiceLocator.CommandBus.Send(new CreateItemCommand(Guid.NewGuid(),item.Title,item.Description,-1,item.From,item.To)); return RedirectToAction("Index"); }