コード例 #1
0
ファイル: HomeController.cs プロジェクト: cuongx/ThiMoudel2
        public IActionResult Edit(EditStudentsViewsModel model)
        {
            var emp = studentsRepository.Get(model.Id);
            var stu = new Students()
            {
                NgaySinh = model.NgaySinh,
                Email    = model.Email,
                GioiTinh = model.GioiTinh,
                HoTen    = model.HoTen,
                LopHocId = model.LopHocId,
                ID       = model.Id
            };
            var lophoc = studentsRepository.Edit(stu);

            if (lophoc != null)
            {
                return(RedirectToAction("Index", new { id = lophoc.ID }));
            }
            ViewBag.LopHoc = GetLopHocs();
            return(View(model));
        }