public async Task <bool> MakeBooking(PracticeInformation practice) { //Doesnt update //Dont use this method for making an appointment -in the app //TODO: Post data to Appointments Collection var filter = Builders <PracticeInformation> .Filter .Eq(x => x.Id, practice.Id); var update = Builders <PracticeInformation> .Update .Set(s => s.Appointment, practice.Appointment); try { UpdateResult updateResult = await _context .PracticeCollection .UpdateOneAsync( filter : filter, update : update, options : new UpdateOptions { IsUpsert = true }); return(updateResult.IsAcknowledged && updateResult.ModifiedCount > 0); } catch (Exception ex) { //log or manage the exception throw ex; } }
public async Task <PracticeInformation> GetPracticeIfDoctorWorksThere(ObjectId _id) { var filter = Builders <PracticeInformation> .Filter.Eq(z => z.Id, _id); PracticeInformation _practiceinfo = new PracticeInformation(); try { _practiceinfo = await _context .PracticeCollection .Find(filter) .FirstOrDefaultAsync(); if (_practiceinfo == null) { return(_practiceinfo); } } catch (Exception ex) { // log Ex // Manage the exception throw new Exception("Failed to Pull Doctors Info: " + new{ _id, _practiceinfo }, ex); } return(_practiceinfo); }
public async void Post([FromBody] string value) { PracticeInformation practice = new PracticeInformation(); AppointmentDto appointment = new AppointmentDto(); //var appointmentMade = await _bookingRepository.AddBooking(practice, appointment); }
public Task <PracticeInformation> GetPracticeDetails(ObjectId _id) { PracticeInformation practiceInformation = new PracticeInformation(); var builder = Builders <PracticeInformation> .Filter; //var filter = builder.Eq<PracticeInformation>(x=>x.Id, _id); //practiceInformation = _context.PracticeCollection.Find(filter).FirstOrDefault(); return(Task.FromResult(practiceInformation)); }
public static PracticeDto CreatePracticeDto(PracticeInformation practice) { PracticeDto newDto = new PracticeDto() { PracticeID = practice.Id, ContactNumber = practice.ContactPractice.PracticeTelephoneNumber, PracticeName = practice.PracticeName, NumberOfPatientsAtPractice = practice.NumOfPatientsInPractice, OperatingTimes = practice.OperatingTime, PracticePicture = practice.PracticePicture }; return(newDto); }
public Task AddPractice(PracticeInformation practice) { throw new NotImplementedException(); }