public async Task <IActionResult> updatestatus([FromBody] AppointmentsEntity appentity, int id) { var ad = auc.Appointments.FirstOrDefault(item => item.appointmentId == id); try { if (ad != null) { ad.status = appentity.Astatus; } auc.Appointments.Update(ad); auc.SaveChanges(); return(Ok(ad)); } catch { return(BadRequest()); } }
public async Task <IActionResult> addappointment([FromBody] AppointmentsEntity appointments) { try { var appoints = new Appointments() { Name = appointments.AName, address = appointments.Aaddress, date1 = appointments.Adate1, timeSlot = appointments.AtimeSlot, Contact = appointments.AContact, status = appointments.Astatus }; auc.Appointments.Add(appoints); auc.SaveChanges(); return(Ok(appoints)); } catch { return(BadRequest()); } }