Example #1
0
 public async Task <ActionResult <Office> > CreateOffice([FromBody] CreateOfficeRequest officeRequest)
 {
     try
     {
         var office = new Office
         {
             Title           = officeRequest.Title,
             OfficeApartment = await _apartmentRepository.FindById(officeRequest.OfficeApartmentId),
             Address         = officeRequest.Address
         };
         return(Ok(await _officeRepository.Create(office)));
     }
     catch (ArgumentException)
     {
         return(Conflict());
     }
 }