public ActionResult DeleteConfirmed(int id) { var DoctorId = User.Identity.GetUserId(); DoctorHospital doctorHospital = db.DoctorHospitals.Find(id); doctorHospital.DoctorId = DoctorId; db.DoctorHospitals.Remove(doctorHospital); db.SaveChanges(); return(RedirectToAction("Index")); }
// GET: DoctorHospitals/Details/5 public ActionResult Details(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } DoctorHospital doctorHospital = db.DoctorHospitals.Find(id); if (doctorHospital == null) { return(HttpNotFound()); } return(View(doctorHospital)); }
public async Task AddDoctorHospital(DoctorHospital doctorHospital) { HttpClient httpClient = new HttpClient(); string docHos = JsonSerializer.Serialize(doctorHospital); StringContent content = new StringContent( docHos, Encoding.UTF8, "application/json" ); HttpResponseMessage responseMessage = await httpClient.PostAsync("https://localhost:8085/hospitalDoctor", content); Console.WriteLine(responseMessage.StatusCode); }
public ActionResult Create([Bind(Include = "Id,DayName,From,To,DoctorId,HospitalId")] DoctorHospital doctorHospital) { var DoctorId = User.Identity.GetUserId(); if (ModelState.IsValid) { doctorHospital.DoctorId = DoctorId; db.DoctorHospitals.Add(doctorHospital); db.SaveChanges(); return(RedirectToAction("Index", "DoctorHospitals")); } ViewBag.HospitalId = new SelectList(db.Hospitals, "Id", "Name", doctorHospital.HospitalId); ViewBag.DayName = new SelectList(new[] { "السبت", "الأحد", "الاثنين", "الثلاثاء", "الأربعاء", "الخميس", "الجمعة" }); ViewBag.From = new SelectList(new[] { "1ص", "2ص", "3ص", "4ص", "5ص", "6ص", "7ص", "8ص", "9ص", "10ص", "11ص", "12م", "1م", "2م", "3م", "4م", "5م", "6م", "7م", "8م", "9م", "10م", "11م", "12ص" }); ViewBag.To = new SelectList(new[] { "1ص", "2ص", "3ص", "4ص", "5ص", "6ص", "7ص", "8ص", "9ص", "10ص", "11ص", "12م", "1م", "2م", "3م", "4م", "5م", "6م", "7م", "8م", "9م", "10م", "11م", "12ص" }); return(View(doctorHospital)); }
// GET: DoctorHospitals/Edit/5 public ActionResult Edit(int?id) { ViewBag.HospitalId = new SelectList(db.Hospitals, "Id", "Name"); ViewBag.DayName = new SelectList(new[] { "السبت", "الأحد", "الاثنين", "الثلاثاء", "الأربعاء", "الخميس", "الجمعة" }); ViewBag.From = new SelectList(new[] { "1ص", "2ص", "3ص", "4ص", "5ص", "6ص", "7ص", "8ص", "9ص", "10ص", "11ص", "12م", "1م", "2م", "3م", "4م", "5م", "6م", "7م", "8م", "9م", "10م", "11م", "12ص" }); ViewBag.To = new SelectList(new[] { "1ص", "2ص", "3ص", "4ص", "5ص", "6ص", "7ص", "8ص", "9ص", "10ص", "11ص", "12م", "1م", "2م", "3م", "4م", "5م", "6م", "7م", "8م", "9م", "10م", "11م", "12ص" }); if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } DoctorHospital doctorHospital = db.DoctorHospitals.Find(id); if (doctorHospital == null) { return(HttpNotFound()); } return(View(doctorHospital)); }