public async Task <ActionResult> Create([Bind(Include = "CategoryId,CategoryName,Decription")] Category category) { if (ModelState.IsValid) { db.Categories.Add(category); await db.SaveChangesAsync(); return(RedirectToAction("Index")); } return(View(category)); }
public async Task <ActionResult> DeleteConfirmed(int id) { Department department = await db.Departments.FindAsync(id); db.Departments.Remove(department); await db.SaveChangesAsync(); return(RedirectToAction("Index")); }
public async Task <ActionResult> Create([Bind(Include = "UserId,Password,FacultyId,GroupId,FullName,DateOfBirth,Gender,Address,Email,PhoneNumber,CreatedDate,Image,Status")] User user) { if (ModelState.IsValid) { db.Users.Add(user); await db.SaveChangesAsync(); return(RedirectToAction("Index")); } ViewBag.FacultyId = new SelectList(_facultyService.GetAll(), "FacultyId", "FacultyName", user.FacultyId); ViewBag.GroupId = new SelectList(_groupService.GetAll(), "GroupId", "GroupName", user.GroupId); return(View(user)); }