public IActionResult AddDiagnosticCenterTimeSlots(string dcId, [FromBody] DiagnosticCenterTimeSlots ts) { try { service.AddDiagnosticCenterTimeSlot(dcId, ts); return(Ok($"Time Slot added for diagnosticCenter with id {dcId}")); } catch (Exception exe) { return(BadRequest(exe.Message)); } }
public void AddDiagnosticCenterTimeSlot(string userid, DiagnosticCenterTimeSlots ts) { Random r = new Random(); ts.slotId = r.Next(1111, 9999).ToString(); ts.diagnosticCenterId = userid; ts.userId = userid; var reqDC = Builders <DiagnosisCenter> .Filter.Eq(dc => dc.userid, userid); var updateReqDC = Builders <DiagnosisCenter> .Update.Push(d => d.diagnosticCenterSlots, ts); dcDbContext.DiagnosisCenters.UpdateOne(reqDC, updateReqDC); }
public bool UpdateTimeSlotOfDiagnosticCenter(string dcId, string slotId, DiagnosticCenterTimeSlots ts) { var _ts = repository.GetSpecificSlotOfDiagnosticCenter(dcId, slotId); if (_ts != null) { return(repository.UpdateTimeSlotOfDiagnosticCenter(dcId, slotId, ts)); } else { throw new TimeSlotNotFoundException("No Such Time Slot Exists"); } }
public IActionResult UpdateSlotOfDoctor(string dcId, string slotId, [FromBody] DiagnosticCenterTimeSlots ts) { try { return(Ok(service.UpdateTimeSlotOfDiagnosticCenter(dcId, slotId, ts))); } catch (TimeSlotNotFoundException tExe) { return(NotFound(tExe.Message)); } catch (Exception exe) { return(BadRequest(exe.Message)); } }
public bool DeleteTimeSlotOfDiagnosticCenter(string userid, string slotId) { var reqDC = Builders <DiagnosisCenter> .Filter.Eq(dc => dc.userid, userid); DiagnosisCenter updateReqDC = dcDbContext.DiagnosisCenters.Find(d => d.userid == userid).SingleOrDefault(); DiagnosticCenterTimeSlots dcTs = updateReqDC.diagnosticCenterSlots.Find(t => t.slotId == slotId); updateReqDC.diagnosticCenterSlots.Remove(dcTs); var result = dcDbContext.DiagnosisCenters.ReplaceOne(reqDC, updateReqDC); if (result.IsAcknowledged && (result.ModifiedCount > 0)) { return(true); } else { return(false); } }
public void AddDiagnosticCenterTimeSlot(string dcId, DiagnosticCenterTimeSlots ts) { repository.AddDiagnosticCenterTimeSlot(dcId, ts); }