public ActionResult DeleteConfirmed(string id)
        {
            tbl_req_af tbl_req_af = db.tbl_req_af.Find(id);

            db.tbl_req_af.Remove(tbl_req_af);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
        // GET: ReqAFRegister/Delete/5
        public ActionResult Delete(string id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            tbl_req_af tbl_req_af = db.tbl_req_af.Find(id);

            if (tbl_req_af == null)
            {
                return(HttpNotFound());
            }
            return(View(tbl_req_af));
        }
        public ActionResult Edit(tbl_req_af tbl_req_af)
        {
            if (ModelState.IsValid)
            {
                db.Entry(tbl_req_af).State = EntityState.Modified;
                db.SaveChanges();

                ViewBag.EmpCount = tbl_req_af.AF_CODE.ToString();
                var         email = Session["USER_EMAIL"].ToString();
                MailMessage mm    = new MailMessage();
                mm.To.Add("*****@*****.**");
                mm.From    = new MailAddress(email);
                mm.Subject = "แบบฟอร์มการขอสิทธิ ALFRESCO";

                mm.IsBodyHtml = true;
                mm.Body       = GetFormattedMessageIT();

                SmtpClient smtp = new SmtpClient();
                smtp.Host                  = "mail01.pranda.co.th";
                smtp.Port                  = 25;
                smtp.EnableSsl             = false;
                smtp.UseDefaultCredentials = true;
                smtp.Credentials           = new System.Net.NetworkCredential();

                System.Net.ServicePointManager.ServerCertificateValidationCallback = delegate(object s,
                                                                                              System.Security.Cryptography.X509Certificates.X509Certificate certificate,
                                                                                              System.Security.Cryptography.X509Certificates.X509Chain chain,
                                                                                              System.Net.Security.SslPolicyErrors sslPolicyErrors)
                {
                    return(true);
                };

                smtp.Send(mm);
                return(RedirectToAction("IndexAF"));
            }

            return(View(tbl_req_af));
        }