public async Task <IActionResult> Create(Department d) { d.DateCreated = DateTime.Now; var createDept = await _dept.AddAsync(d); if (createDept) { Alert("Book Created successfully.", NotificationType.success); //Alert("Department Created unsuccessfully.", NotificationType.error); return(RedirectToAction("Index")); } else { Alert("Department Not Created, Name already exists or bad data entered", NotificationType.error); } return(View()); }
public async Task <IActionResult> Create(Department department) { department.CreatedBy = _userManager.GetUserName(User); department.DateCreated = DateTime.Now; var createAepartment = await _department.AddAsync(department); //if (createAepartment) //{ // return RedirectToAction("Index"); //} if (createAepartment) { Alert("Department created successfully😃.", NotificationType.success); return(RedirectToAction("Index")); } else { Alert("Department not created😔!", NotificationType.error); } return(View()); }