public IHttpActionResult getDoctorTimeFree(int id, [FromBody] TimeFreeModel entity) { try { if (entity == null) { ModelState.AddModelError("Entity", "First set the entity"); } if (!MedicalWebServices.ExistsDoctor(id)) { ModelState.AddModelError("Id", "The doctor Id doesn't exists in a Medical System"); } if (!ModelState.IsValid) { return(BadRequest(ModelState)); } var lstTimeFree = assignmentServices.getTimeFreeByDoctorID(id, Convert.ToDateTime(entity.InitialDate), Convert.ToDateTime(entity.EndDate)); return(Ok(lstTimeFree)); } catch (Exception e) { return(InternalServerError(e)); } }
public IHttpActionResult getAssignedDoctor(int id) { try { if (!MedicalWebServices.ExistsDoctor(id)) { ModelState.AddModelError("Id", "The doctor Id doesn't exists in a Medical System"); } var result = assignmentServices.getAssignmentByDoctor(id); if (!result.Any()) { return(NotFound()); } return(Ok(result)); } catch (Exception e) { return(InternalServerError(e)); } }