コード例 #1
0
        public ActionResult Create([Bind(Include = "Id,Name,PhoneNo,AddressStreet,AddressTown,AddressCounty,AddressPostalCode")] RestaurantVM restaurant)
        {
            if (ModelState.IsValid)
            {
                Restaurant res = _restaurantFacade.Create(new Restaurant
                {
                    Id                = restaurant.Id,
                    CompanyId         = _companyFacade.Get().Id,
                    Name              = restaurant.Name,
                    PhoneNo           = restaurant.PhoneNo,
                    AddressStreet     = restaurant.AddressStreet,
                    AddressTown       = restaurant.AddressTown,
                    AddressCounty     = restaurant.AddressCounty,
                    AddressPostalCode = restaurant.AddressPostalCode
                });
                return(RedirectToAction("Details", new { Id = res.Id }));
            }

            return(View(restaurant));
        }