Beispiel #1
0
        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));
        }
Beispiel #2
0
        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"));
        }
Beispiel #3
0
        public ActionResult Add(ModelsItemDto item)
        {
            ServiceLocator.CommandBus.Send(new CreateItemCommand(Guid.NewGuid(), item.Title, item.Description, -1, item.From, item.To));

            return(RedirectToAction("Index"));
        }