Пример #1
0
        public ActionResult Create(ToChucThiViewModel tochucthiView)
        {
            try
            {
                if (ModelState.IsValid)
                {
                    ToChucThiViewModel tochucthi = new ToChucThiViewModel()
                    {
                        ListUsers = _userMaster.GetAllUsersActiveList(),
                        ListDeThi = _deThi.GetAllActiveDeThi()
                    };
                    return(View(tochucthi));
                }

                else
                {
                    var tochucthi = AutoMapper.Mapper.Map <ToChucThi>(tochucthiView);
                    tochucthi.Status = true;

                    tochucthi.ID = 0;

                    _tochucthi.AddToChucThi(tochucthi);

                    return(RedirectToAction("Create", "ToChucThi"));
                }
            }
            catch (Exception)
            {
                throw;
            }
        }
Пример #2
0
 public ActionResult Create()
 {
     try
     {
         ToChucThiViewModel tochucthi = new ToChucThiViewModel()
         {
             ListUsers = _userMaster.GetAllUsersActiveList(),
             ListDeThi = _deThi.GetAllActiveDeThi()
         };
         return(View(tochucthi));
     }
     catch (Exception)
     {
         throw;
     }
 }