Beispiel #1
0
        public ActionResult PostOrderDetail(DrugOrderModel model)
        {
            using (ProjectEntities db = new ProjectEntities())
            {
                if (model.Decision != null)
                {
                    if (model.Decision == "Dispatched")
                    {
                        var    getdata = db.PatientOrderDetails.SingleOrDefault(a => a.OrderId == model.OrderId);
                        string status  = getdata.OrderStatus;
                        if (status != "Dispatched")
                        {
                            db.UpdatePatientOrderDetails(model.OrderId, model.Decision);

                            return(Json("Item Dispatched"));
                        }
                        else
                        {
                            return(Json("Oops! Item has already been Dispatched"));
                        }
                    }
                    else
                    {
                        var    getdata = db.PatientOrderDetails.SingleOrDefault(a => a.OrderId == model.OrderId);
                        string status  = getdata.OrderStatus;
                        if (status == "Dispatched")
                        {
                            db.UpdatePatientOrderDetails(model.OrderId, model.Decision);
                            db.UpdateDrugDelivery(model.OrderId, DateTime.Now);

                            return(Json("Item Delivered"));
                        }
                        else
                        {
                            return(Json("Ooops ! Item has not been Dispatched yet"));
                        }
                    }
                }
                else
                {
                    return(Json("Please Choose Your Decision"));
                }
            }
        }