public ActionResult Create([Bind(Include = "Id,Value,Name")] Product product)
        {
            if (ModelState.IsValid)
            {
                db.Products.Add(product);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(product));
        }
Beispiel #2
0
        public ActionResult Create([Bind(Include = "Id,Name,Cpf,Phone,Email,HotelId")] Client client)
        {
            if (ModelState.IsValid)
            {
                db.Clients.Add(client);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            ViewBag.HotelId = new SelectList(db.Hotels, "Id", "Name", client.HotelId);
            return(View(client));
        }
Beispiel #3
0
        public ActionResult Create([Bind(Include = "Id,ClientId")] Billing billing)
        {
            if (ModelState.IsValid)
            {
                db.Billings.Add(billing);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            ViewBag.ClientId = new SelectList(db.Clients, "Id", "Name", billing.ClientId);
            return(View(billing));
        }