public async Task <IActionResult> Create([Bind("Id,Name,DepartmentID")] Classe classe)
        {
            if (ModelState.IsValid)
            {
                if (!cls.IfExists(classe.Name, null))
                {
                    cls.Add(classe);
                    await cls.SaveChangesAsync();

                    return(RedirectToAction("Index"));
                }
            }
            ViewData["DepartmentID"] = new SelectList(dep.DropDownList(), "Id", "Name", classe.DepartmentID);
            return(View(classe));
        }
示例#2
0
 public bool Add(E_Model.Class model)
 {
     return(dal.Add(model));
 }