Beispiel #1
0
        //[FromRoute] int id, [Bind("Name")]Restaurant restaurant
        public ActionResult Edit([FromRoute] int id, [Bind("Name")] Customer customer)
        {
            try
            {
                // edit does not work

                if (ModelState.IsValid)
                {
                    Lib.Customer libRest = CRepo.GetCustomerById(id);
                    libRest.FirstName      = customer.FirstName;
                    libRest.LastName       = customer.LastName;
                    libRest.DefaultStoreId = customer.DefaultStoreId;
                    CRepo.Save();

                    return(RedirectToAction(nameof(Index)));
                }
                return(View(customer));
            }
            catch
            {
                return(View(customer));
            }
        }