示例#1
0
 public void Add(FacultCreate facult)
 {
     facult.FacultInstance.IsReady = false;
     _ctx.Facults.Add(facult.FacultInstance);
     if (facult.StudGroupsNames != null)
     {
         foreach (var group in facult.StudGroupsNames)
         {
             group.LastCheck = DateTime.Now;
             _ctx.StudGroups.Add(group);
         }
     }
 }
示例#2
0
        public ActionResult Create(FacultCreate model)
        {
            if (ModelState.IsValid)
            {
                _db.Facults.Add(model);
                _db.SaveChanges();
                ExcelTemplate.Save(model.Template, model.FacultInstance);
                if (!Roles.RoleExists(model.FacultInstance.FacultId.ToString(CultureInfo.InvariantCulture)))
                {
                    Roles.CreateRole(model.FacultInstance.FacultId.ToString(CultureInfo.InvariantCulture));
                }

                return(RedirectToAction("Index"));
            }

            return(View(model));
        }