public IActionResult calenderIdLookup([FromQuery] string calName, [FromQuery] string startTime) { DateTime starttimeDateTime; DateTime.TryParse(startTime, CultureInfo.InvariantCulture, DateTimeStyles.None, out starttimeDateTime); if (calName == null || starttimeDateTime == DateTime.MinValue) { return(BadRequest()); } CalendarModel test = db.dateLookup(calName, starttimeDateTime); if (test == null) { return(NotFound()); } return(Ok(test.id)); }
public IActionResult addAppointment([FromBody] addAppointmentViewModel model) { if (model.Appointment == null || model.calendarName == null || model.Appointment.CustomerId == ObjectId.Empty || model.Appointment.aptstartTime == DateTime.MinValue || model.Appointment.aptendTime == DateTime.MinValue) { return(BadRequest(ErrorMessageConstants.MODEL_INVAILD)); } CalendarAccessor calDb = new CalendarAccessor(); ObjectId calID = calDb.dateLookup(model.calendarName, model.Appointment.aptstartTime).id; AppointmentModel returnedItem = db.addAppointment(calID, model.Appointment); if (returnedItem == null) { return(StatusCode(409, ErrorMessageConstants.APPOINTMENT_CONFLICT)); } return(Ok(returnedItem)); }