コード例 #1
0
        public ActionResult Edit(EditDinnerCommand editDinnerCommand)
        {
            var dinnerId = editDinnerCommand.DinnerId;
            var dinner = dinnerReadModel.GetDinnerById(dinnerId);

            if(!dinnerReadModel.DinnerIsHostedBy(dinnerId, User.Identity.Name))
                return View("InvalidOwner");

            try
            {
                var dinnerHost = new DinnerHost();
                var location = new Location();
                UpdateModel(dinnerHost);
                UpdateModel(location);

                editDinnerCommand.Host = dinnerHost;
                editDinnerCommand.Location = location;
                commandService.EditDinner(editDinnerCommand);
                TempData["Dinner"] = dinner;
                return RedirectToAction("Details", new {id = dinner.DinnerId});
            }
            catch
            {
                return View(dinner);
            }
        }
コード例 #2
0
 public void EditDinner(EditDinnerCommand editDinnerCommand)
 {
     commandBus.Execute(editDinnerCommand);
 }