public async Task <IActionResult> OnGetAsync(int?id) { department = await _departmentService.GetDepartmentById(id.Value); if (department == null) { return(NotFound()); } return(Page()); }
public async Task CreateDepartmentAsync(DeprtmentViewModel departmenntVM) { var department = new Department() { Budget = departmenntVM.Budget, Name = departmenntVM.DeprtmentName, StartDate = departmenntVM.StartDate }; await _departmentRepository.AddAsync(department); }
public async Task UpdateDepartmentAsync(DeprtmentViewModel departmenntVM) { _logger.LogInformation("UpdateDepartmentAsync called."); var department = new Department() { Id = departmenntVM.DeprtmentId, Budget = departmenntVM.Budget, Name = departmenntVM.DeprtmentName, StartDate = departmenntVM.StartDate }; await _departmentRepository.UpdateAsync(department); }