public async Task <Department> InsertAsync(DepartmentInsertRequestViewModel request) { Department aDepartment = new Department(); aDepartment.Code = request.Code; aDepartment.Name = request.Name; return(await _departmentRepository.InsertAsync(aDepartment)); }
public async Task <Department> InsertAsync(DepartmentInsertRequestViewModel request) { Department aDepartment = new Department(); aDepartment.Code = request.Code; aDepartment.Name = request.Name; await _unitOfWork.DepartmentRepository.CreateAsync(aDepartment); if (await _unitOfWork.SaveCompletedAsync()) { return(aDepartment); } throw new AplicationValidationException("department insert has some problem"); }
public async Task <IActionResult> Insert(DepartmentInsertRequestViewModel request) { return(Ok(await _departmentService.InsertAsync(request))); }