// GET: WorkOrder public ActionResult Index() { Session["workorder"] = null; // Summaryviewmodel Session["workorder_DB"] = null; // workorder model User currentUser = (User)Session["user"]; bool isDoctor = currentUser.Employee.JobTitle.Title == JobTitle.Doctor; WorkOrderVisitTypeViewModel wovtvm = new WorkOrderVisitTypeViewModel(); wovtvm.CreateWorkOrderVisitTypeViewModel(isDoctor); return(View("Index", wovtvm)); }
public ActionResult CreateWorkOrder(WorkOrderVisitTypeViewModel wovtvm) { User currentUser = (User)Session["user"]; bool isDoctor = currentUser.Employee.JobTitle.Title == JobTitle.Doctor; Service service = DB.Services.FirstOrDefault(x => x.ServiceId == wovtvm.SelectedServiceId); if (service == null || !service.PreventiveVisit && !isDoctor) { wovtvm.CreateWorkOrderVisitTypeViewModel(isDoctor); return(View("Index", wovtvm)); } WorkOrderViewModel wovm = new WorkOrderViewModel(); wovm.SelectedServiceId = wovtvm.SelectedServiceId; wovm.EnterMedicine = service.RequiresMedicine; wovm.EnterBloodSample = service.RequiresBloodSample; wovm.EnterPatients = service.RequiresPatients; return(View("Create", wovm)); }