Пример #1
0
        public async Task <ActionResult> Create([Bind(Include = "ID_capdau,IDclbNha,IDclbKhach")] CapDau capDau)
        {
            if (ModelState.IsValid)
            {
                db.CapDaus.Add(capDau);
                await db.SaveChangesAsync();

                return(RedirectToAction("Index"));
            }

            ViewBag.IDclbNha   = new SelectList(db.CLBs, "IDclb", "TenClb", capDau.IDclbNha);
            ViewBag.IDclbKhach = new SelectList(db.CLBs, "IDclb", "TenClb", capDau.IDclbKhach);
            return(View(capDau));
        }
Пример #2
0
        public async Task <ActionResult> Create([Bind(Include = "IDCapdau,IDLich,KetQua")] LichCapDau lichCapDau)
        {
            if (ModelState.IsValid)
            {
                db.LichCapDaus.Add(lichCapDau);
                await db.SaveChangesAsync();

                return(RedirectToAction("Index"));
            }

            ViewBag.IDCapdau = new SelectList(db.CapDaus, "ID_capdau", "ID_capdau", lichCapDau.IDCapdau);
            ViewBag.IDLich   = new SelectList(db.Liches, "ID_lich", "NgayDau", lichCapDau.IDLich);
            return(View(lichCapDau));
        }