public DbEntityValidationException AddOrUpdateHotelRestaurant(HotelRestaurant model, List <string> propertyNames)
        {
            using (var repo = Repo <HotelRestaurantRepository>())
            {
                try
                {
                    if (model.Id == Guid.Empty)
                    {
                        var dbModel = repo.CreateDefaultModel();
                        foreach (var propertyName in propertyNames)
                        {
                            dbModel.GetType().GetProperty(propertyName).SetValue(dbModel, model.GetType().GetProperty(propertyName).GetValue(model));
                        }
                        repo.AddOrUpdateDoCommit(dbModel);
                    }
                    else
                    {
                        repo.PartialUpdateDoCommit(model, propertyNames);
                    }
                }
                catch (DbEntityValidationException ex)
                {
                    return(ex);
                }
            }

            return(null);
        }
        public ActionResult EditHotel(HotelRestaurant model)
        {
            var propertyNames = Request.Form.AllKeys.Where(field => field != "Id" && field != "X-Requested-With").ToList();

            var exception = ProcessInvoke <HotelRestaurantProcess>().AddOrUpdateHotelRestaurant(model, propertyNames);

            if (exception != null)
            {
                GetHotelRelatedItems();
                return(View(model));
            }

            return(RedirectToAction("SubmitSuccess", "Common",
                                    new { targetAction = "EditHotel", targetcontroller = "Management", target = "slide-up-content", postform = "hotel" }));
        }