//
 // GET: /Manifest_Control_Section/Reject_Manifest/W0009
 public ActionResult Reject_Manifest(Reject_ReasonModel reject_reason_model)
 {
     var way_bill_id = Convert.ToInt32(TempData["way_bill_id"]);
         var way_bill = (from w in db.Way_Bill
                         join i in db.Imports on w.import_id equals i.import_id
                         where w.way_bill_id == way_bill_id
                         select new { w.way_bill_id, i.import_id, w.way_bill_code }).First();
         Import import = db.Imports.Find(way_bill.import_id);
         import.importing_status_id = 13;
         db.Entry(import).State = EntityState.Modified;
         db.SaveChanges();
         Reject_Reason reject_reason = new Reject_Reason();
         reject_reason.way_bill_id = way_bill_id;
         reject_reason.reject_reason = reject_reason_model.reason;
         reject_reason.reject_from = "Manifest Control Section";
         reject_reason.rejected_date = DateTime.Now;
         db.Reject_Reason.Add(reject_reason);
         db.SaveChanges();
         TempData["errorMessage"] = "Manifest Control Section Rejected";
         return RedirectToAction("Index", new { way_bill_id = way_bill_id });
 }
 //
 // GET: /Manifest_Control_Section/Reject_Manifest/W0009
 public ActionResult Reject_Manifest(Reject_ReasonModel reject_reason_model)
 {
     if (Session["login_status"] != null)
     {
         int[] z = (int[])Session["function_id"];
         if (z.Contains(17))
         {
             var way_bill_id = Convert.ToInt32(TempData["way_bill_id"]);
             var way_bill = (from w in db.Way_Bill
                             join i in db.Imports on w.import_id equals i.import_id
                             where w.way_bill_id == way_bill_id
                             select new { w.way_bill_id, i.import_id, w.way_bill_code }).First();
             Import import = db.Imports.Find(way_bill.import_id);
             import.importing_status_id = 13;
             db.Entry(import).State = EntityState.Modified;
             db.SaveChanges();
             Reject_Reason reject_reason = new Reject_Reason();
             reject_reason.way_bill_id = way_bill_id;
             reject_reason.reject_reason = reject_reason_model.reason;
             reject_reason.reject_from = "Manifest Control Section";
             reject_reason.rejected_date = DateTime.Now;
             db.Reject_Reason.Add(reject_reason);
             db.SaveChanges();
             TempData["errorMessage"] = "Manifest Control Section Rejected";
             return RedirectToAction("Index");
         }
         else
         {
             return RedirectToAction("../Home/Dashboard");
         }
     }
     else
     {
         return RedirectToAction("../Home");
     }
 }