public ActionResult Create(AppointmentModel am) { String currentUserId = User.Identity.GetUserId(); List <User> GetUsers = SA.GetUsers(); var user = GetUsers.FirstOrDefault(u => u.Id == currentUserId); try { Appointment a = new Appointment() { Specialities = am.Specialities, Date = am.Date, Location = am.Location, DoctorId = am.Doctor.Id, PatientId = currentUserId }; SA.AddAppointment(a); SA.Commit(); return(RedirectToAction("Index")); } catch { return(View()); } }
public IHttpActionResult Delete(String id, Appointment a) { var req = sp.GetMany().Where(b => b.AppointmentId.Equals(id)).FirstOrDefault(); sp.Delete(req); sp.Commit(); return(Ok()); }