public ActionResult StandingOrder(StandingOrderViewModel so, HttpPostedFileBase inputFile) {
            if (!string.IsNullOrEmpty(so.StandingOrder.IssuingAuthority)) {
                if (!string.IsNullOrEmpty(so.StandingOrder.Subject)) {
                    if (!string.IsNullOrEmpty(so.StandingOrder.Year)) {
                        if (!string.IsNullOrEmpty(so.StandingOrder.Revision)) {
                            if (inputFile != null && inputFile.ContentLength > 0) {
                                if (inputFile.ContentType == "application/pdf") {
                                    if (so.StandingOrder.IssuingAuthority.Equals("OTHERS")) {
                                        string strType = so.OIssuingAutherity.Trim().ToUpper();
                                        if (!string.IsNullOrEmpty(strType)) {
                                            string keyName = "IssuingAuthority";
                                            if (keyName != string.Empty) {
                                                so.StandingOrder.IssuingAuthority = so.OIssuingAutherity.Trim().ToUpper();
                                                string keyValue = so.StandingOrder.IssuingAuthority;
                                                AddParam(keyName, keyValue);
                                            }
                                        }
                                        else {
                                            TempData["Error"] = "Please Enter Issuing Authority.";
                                        }
                                    }

                                    if (so.StandingOrder.Subject.Equals("OTHERS")) {
                                        string strSubject = so.OSubject.Trim().ToUpper();
                                        if (!string.IsNullOrEmpty(strSubject)) {
                                            string keyName = "SoSubject";
                                            if (keyName != string.Empty) {
                                                so.StandingOrder.Subject = so.OSubject.Trim().ToUpper();
                                                string keyValue = so.StandingOrder.Subject;
                                                AddParam(keyName, keyValue);
                                            }
                                        }
                                        else {
                                            TempData["Error"] = "Please Enter Subject.";
                                        }
                                    }

                                    Guid FileName = Guid.NewGuid();
                                    so.StandingOrder.FilePath = "/Uploads/StandingOrders/" + FileName + ".pdf";
                                    string tPath = Path.Combine(Server.MapPath("~/Uploads/StandingOrders/"), FileName + ".pdf");
                                    inputFile.SaveAs(tPath);

                                    so.StandingOrder.CreatedBy = Request.Cookies["INDMS"]["UserID"];
                                    so.StandingOrder.CreatedDate = null;

                                    db.StandingOrders.Add(so.StandingOrder);
                                    db.SaveChanges();

                                    TempData["RowId"] = so.StandingOrder.id;
                                    TempData["MSG"] = "Save Successfully";

                                    return RedirectToAction("StandingOrder");
                                }
                                else {
                                    TempData["Error"] = "Please Select PDF file only";
                                }
                            }
                            else {
                                TempData["Error"] = "Please Select file";
                            }
                        }
                        else {
                            TempData["Error"] = "Please Enter Revision.";
                        }
                    }
                    else {
                        TempData["Error"] = "Please Enter Year.";
                    }
                }
                else {
                    TempData["Error"] = "Please Select Subject";
                }
            }
            else {
                TempData["Error"] = "Please select Issuing Authority.";
            }

            so.StandingOrders = db.StandingOrders.OrderByDescending(x => x.id);

            return View(so);
        }
 public ActionResult StandingOrder() {
     StandingOrderViewModel so = new StandingOrderViewModel();
     so.StandingOrders = db.StandingOrders.OrderByDescending(x => x.id);
     return View(so);
 }