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);
            }
        }
Beispiel #2
0
 public bool Equals(DinnerHost other)
 {
     if (ReferenceEquals(null, other))
     {
         return(false);
     }
     if (ReferenceEquals(this, other))
     {
         return(true);
     }
     return(other.HostedById.Equals(HostedById) && Equals(other.HostedBy, HostedBy));
 }
Beispiel #3
0
 public bool Equals(DinnerHost other)
 {
     if(ReferenceEquals(null, other)) return false;
     if(ReferenceEquals(this, other)) return true;
     return other.HostedById.Equals(HostedById) && Equals(other.HostedBy, HostedBy);
 }