public async Task <ActionResult <Therapy> > PostTherapy(Therapy therapy) { try { await _service.AddTherapy(therapy); } catch (TherapyAdlAlreadyExistException e) { return(Conflict(e)); } catch (TherapyAbbreviationAlreadyExistException e) { return(Conflict(e)); } catch (TherapyMainDoesNotExistException e) { return(BadRequest(e)); } catch (DbUpdateException) { throw; } return(CreatedAtAction("GetTherapy", new { id = therapy.Adl }, therapy)); }
public IHttpActionResult AddTherapy([FromBody] Therapy therapy) { therapy.Date = therapy.Date.ToLocalTime(); _therapyService.AddTherapy(therapy); return(Ok()); }