public ActionResult SaveTheatrRequest(NurseTheatreRequest data) { //var OpdIpd = data.OpdRegisters.OrderByDescending(e => e.Id).FirstOrDefault(); data.UserId = (int)Session["UserId"]; var user = db.Users.Find(data.UserId); data.RequestingNurse = user.Employee.FName + " " + user.Employee.OtherName + " ( " + user.Username + " ) "; data.BranchId = 1; data.AddedOn = DateTime.Now; data.Assigned = false; db.NurseTheatreRequests.Add(data); db.SaveChanges(); return(RedirectToAction("ViewOTRequest", new { id = data.Id })); }
public ActionResult ConfirmTheatre(int?id, string QueueType = "OPD") { NurseTheatreRequest obj = db.NurseTheatreRequests.Find(id); if (obj != null) { obj.Assigned = true; UpdateModel(obj); if (db.SaveChanges() > 0) { var dat = new BillPayment(); var nursereq = db.Services.FirstOrDefault(e => e.DepartmentId == 40); var billService = new BillService(); billService.OPDNo = obj.OPDNo; billService.DepartmentId = nursereq.DepartmentId; billService.SeviceId = nursereq.Id; billService.ServiceName = nursereq.ServiceName; billService.Price = nursereq.CashPrice; billService.Quatity = 1; billService.Award = 0; billService.DoctorFee = 0; billService.Paid = false; billService.Offered = false; billService.DateAdded = DateTime.Now; billService.UserId = int.Parse(Session["UserId"].ToString()); billService.BranchId = 1; billService.IsNurse = false; db.BillServices.Add(billService); db.SaveChanges(); } ViewBag.QueueType = QueueType; } else { return(Content("Not such an object")); } return(Content("Request Approved")); }