public async Task <ApiResponse> GetOfficeById(long id) { var office = await _officeRepo.FindOfficeById(id); if (office == null) { return(new ApiResponse(404)); } var officeTransferDTOs = _mapper.Map <OfficeTransferDTO>(office); return(new ApiOkResponse(officeTransferDTOs)); }
public IActionResult DeleteOffice(int id) { var office = _officeRepository.FindOfficeById(id); if (office == null) { return(NotFound()); } _officeRepository.DeleteOffice(office); return(Ok()); }
public ResponseViewModel UpdateOffice(OfficeViewModel model) { var office = _officeRepository.FindOfficeById(model.Id); if (office != null) { office.Name = model.Name; office.Adress = model.Adress; _officeRepository.UpdateOffice(office); return(new ResponseViewModel() { Message = "Update!", Result = true }); } else { return(new ResponseViewModel() { Message = "Not Update!", Result = false }); } }