//بيقدم في العيادة الاكشن دا بستخدمه للتقديم ع العيادة // بيبعلتي اليايدي بتاع اليوزر الحالي والايدي بتاع العياده اللي هو واقف فيها public ActionResult Apply(string Message) { var UserId = User.Identity.GetUserId(); var ClinicId = (int)Session["ClinicId"]; var Check = DB.ApplyForClinics.Where(a => a.ClinicId == ClinicId && a.UserId == UserId).ToList(); if (Check.Count < 1) { var clinic = new ApplyForClinic(); clinic.ClinicId = ClinicId; clinic.UserId = UserId; clinic.Message = Message; clinic.ApplyDate = DateTime.Now; DB.ApplyForClinics.Add(clinic); DB.SaveChanges(); ViewBag.Result = "Well Done, You applied successfully"; return(View()); } else { ViewBag.Result = "sorry, you applied before!"; return(View()); } }
public ActionResult Edit(ApplyForClinic clinic) { if (ModelState.IsValid) { clinic.ApplyDate = DateTime.Now; DB.Entry(clinic).State = EntityState.Modified; DB.SaveChanges(); return(RedirectToAction("GetClinicsByUser")); } return(View(clinic)); }
public ActionResult Delete(ApplyForClinic clinic) { try { var myclinic = DB.ApplyForClinics.Find(clinic.Id); DB.ApplyForClinics.Remove(myclinic); DB.SaveChanges(); return(RedirectToAction("GetClinicsByUser")); } catch { return(View(clinic)); } }