public ActionResult Allot(Bed_Allocation bedallot) { Bed_Allocation bedallotvals = new Bed_Allocation(); using (dbPatientBillingEntities8 dbBedModel = new dbPatientBillingEntities8()) { if (dbBedModel.Bed_Allocation.Any(x => x.Patient_ID == bedallot.Patient_ID)) { ViewBag.Duplicatemsg = "Patient already alloted."; return(View("Allot", bedallot)); } else { bedallotvals.Patient_ID = bedallot.Patient_ID; bedallotvals.Patient_Name = bedallot.Patient_Name; bedallotvals.Ward_Aolloted = bedallot.Ward_Aolloted; bedallotvals.Bed_Aolloted = bedallot.Bed_Aolloted; } dbBedModel.Bed_Allocation.Add(bedallotvals); dbBedModel.SaveChanges(); } ModelState.Clear(); ViewBag.SuccessMessage = "Bed Alloted"; return(View("Allot", new Bed_Allocation())); }
public ActionResult Allot() { dbPatientBillingEntities8 dbBedModel = new dbPatientBillingEntities8(); Bed_Allocation bedallot = new Bed_Allocation(); return(View(bedallot)); }