public ActionResult QuestionForm(Donor_Information di) { CheckSession(); if (di.Medicine == true) { if (di.Medicine_Text == null) { ModelState.AddModelError("Medicine_Text", "Please fill the Medicine field"); return(View()); } } if (ModelState.IsValid) { if (di.Blood_pressure == true || di.Heart_Disease == true || di.Blood_Diabetes == true || di.Surgery == true) { ViewBag.data = "Not Eligible To Donate"; return(View()); } UpdateCanDonate(GetUrlId()); di.Donor_No = GetUrlId(); di.User_No = int.Parse(Session["UserId"].ToString()); di.Date = DateTime.Now; db.Donor_Information.Add(di); db.SaveChanges(); } return(RedirectToAction("Index")); }
public void updateIsDonate(int di_Id) { Donor_Information d = db.Donor_Information.Find(di_Id); d.IsDonate = 1;; db.Entry(d).State = System.Data.Entity.EntityState.Modified; db.SaveChanges(); }