public ActionResult AssignInspector(int id, int sender)
        {
            //var lor = db.loan_officer_assign.Add(AI)
            // OfficerAssign OA = new OfficerAssign();
            //var AI = AI1.Find(p => p.officer_id == id);
            loan_officer_assign oa = new loan_officer_assign();

            oa.application_id = sender;
            oa.officer_id     = id;
            db.loan_officer_assign.Add(oa);
            db.SaveChanges();

            loan_application la = new loan_application();

            la = db.loan_application.Find(sender);
            //if(la == null)
            //{
            //    return HttpNotFound();
            //}
            la.status = "Assigned";
            db.SaveChanges();
            officer O1          = db.officers.Find(id);
            string  EID         = O1.email_id;
            string  OfficerName = O1.name;
            string  AppID       = oa.application_id.ToString();

            SendVerificationLinkEmail(EID, OfficerName, AppID);
            return(RedirectToAction("ApplicationList", "View_Loan_Applications"));
        }
        public ActionResult ApprovedOrRejected(int id)
        {
            if (ModelState.IsValid)
            {
                loan_officer_assign loa = new loan_officer_assign();
                loa = db.loan_officer_assign.SingleOrDefault(p => p.application_id == id);
                //var Applicant = db.loan_application.Find(id);
                //string strDDLValue = Request.Form["ddldtatus"].ToString();
                //Applicant.status = strDDLValue;
                //db.SaveChanges();

                //loan_app_or_rej lp = new loan_app_or_rej();
                //lp.date_of_approval = (DateTime)DateTime.Now;
                //lp.application_id = Applicant.application_id;
                //lp.amount_sanctioned = Applicant.loan_amount;
                //lp.status = strDDLValue;
                //lp.interest_rate = 7.50;
                //lp.reasons = "Wont tell you";
                //db.loan_app_or_rej.Add(lp);
                //db.SaveChanges();

                var    Applicant   = db.loan_application.Find(id);
                string strDDLValue = Request.Form["ddldtatus"].ToString();
                Applicant.status = strDDLValue;
                db.SaveChanges();

                loan_app_or_rej lp = new loan_app_or_rej();
                lp.date_of_approval  = (DateTime)DateTime.Now;
                lp.application_id    = Applicant.application_id;
                lp.amount_sanctioned = Applicant.loan_amount;
                lp.status            = strDDLValue;
                lp.interest_rate     = 7.50;
                lp.reasons           = "Wont tell you";
                db.loan_app_or_rej.Add(lp);
                db.SaveChanges();

                officer O1          = db.officers.Find(loa.officer_id);
                string  EID         = O1.email_id;
                string  OfficerName = O1.name;
                string  AppID       = Applicant.application_id.ToString();
                SendVerificationLinkEmailToOfficer(EID, OfficerName, AppID, lp.status);
                return(RedirectToAction("ApplicationList", "View_Loan_Applications"));
            }
            return(RedirectToAction("ApplicationList", "View_Loan_Applications"));

            // return View();
        }