public ActionResult Outgoing(string Checkout, string Search, int?BloodTypeNo, int?DonorNo, int?CollectionId) { ViewBag.BloodTypeNo = new SelectList(db.Blood_Type, "Blood_Type_Id", "Type_Name"); if (!string.IsNullOrEmpty(Search)) { List <vwStatusInfo> vw = new List <vwStatusInfo>(); if (BloodTypeNo == null) { vw = db.vwStatusInfoes.Where(x => x.Blood_Status_No == true && x.IsUsed == false && x.Donate_Type == "V" && x.IsDelete != true).ToList(); } else { vw = db.vwStatusInfoes.Where(x => x.Blood_Type_Id == BloodTypeNo && x.Blood_Status_No == true && x.IsUsed == false && x.Donate_Type == "V" && x.IsDelete != true).ToList(); } if (vw.Count() < 1) { ViewBag.msg = "No Available Blood for this Type !"; return(View()); } else { return(View(vw)); } } else { Incoming_Blood inc = new Incoming_Blood(); Donor donor = new Donor(); inc = GetIncominginfo(CollectionId); donor = GetDonorInfo(DonorNo); Outgoing_Blood outg = new Outgoing_Blood(); inc.IsUsed = true; db.Entry(inc).State = System.Data.Entity.EntityState.Modified; db.SaveChanges(); outg.Collection_No = (int)CollectionId; outg.Date = DateTime.Now; db.Outgoing_Blood.Add(outg); db.SaveChanges(); ViewBag.msg = "Checkout Successfully"; return(View()); } }
public ActionResult Withdrawal(int Collection, int Donor_No) { Incoming_Blood inc = new Incoming_Blood(); Donor donor = new Donor(); inc = GetIncominginfo(Collection); donor = GetDonorInfo(Donor_No); Outgoing_Blood outg = new Outgoing_Blood(); inc.IsUsed = true; db.Entry(inc).State = System.Data.Entity.EntityState.Modified; db.SaveChanges(); outg.Collection_No = Collection; outg.Patient_No = (int)donor.Patient_No; outg.Date = DateTime.Now; db.Outgoing_Blood.Add(outg); db.SaveChanges(); TempData["msg"] = "Checkout Successfully"; return(View()); }