コード例 #1
0
        public async Task <Department> AddDepartmentAsync(DepartInsertRequest request)
        {
            Department department = new Department()
            {
                Code = request.Code,
                Name = request.Name
            };
            await _unitOfWork.DepartmentRepository.CreateAsync(department);

            if (await _unitOfWork.ApplicationSaveChangesAsync())
            {
                return(department);
            }
            throw new MyAppException("something went wrong");
        }
コード例 #2
0
        public async Task <Department> AddDepartmentAsync(DepartInsertRequest request)
        {
            Department department = new Department()
            {
                Code = request.Code,
                Name = request.Name
            };
            await _unitOfWork.DepartmentRepository.InsertAsync(department);

            if (await _unitOfWork.DbSaveChangeAsync())
            {
                return(department);
            }
            throw new ExceptionManagementHelper("something went wrong");
        }
 public async Task <ActionResult> AddDepartment(DepartInsertRequest aDepartment)
 {
     return(Ok(await _departmentService.AddDepartmentAsync(aDepartment)));
 }