示例#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 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));
 }
示例#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);
 }