Ejemplo n.º 1
0
 public ActionResult RegistrationPage(Tbl_ClientMaster tblobj, HttpPostedFileBase gstdoc)
 {
     try
     {
         MVCHelper.SaveUser(tblobj, gstdoc);
         TempData["msg"] = "Data saved successfully.";
     }
     catch (Exception ex)
     {
         TempData["error"] = "Somthing went wrong.!";
     }
     return(View());
 }
Ejemplo n.º 2
0
        public static void SaveUser(Tbl_ClientMaster obj, HttpPostedFileBase doc)
        {
            string filepath = System.Configuration.ConfigurationManager.AppSettings["SaveFilePath"];

            using (GSTDB db = new GSTDB())
            {
                obj.DOJ = DateTime.Now;
                db.Tbl_ClientMaster.Add(obj);
                db.SaveChanges();
                if (doc != null && doc.ContentLength > 0)
                {
                    var fileName = Path.GetFileName(doc.FileName);
                    doc.SaveAs(Path.Combine(filepath, DateTime.Now.ToString("ddMMyyyy_" + obj.ClientID + ".jpg")));
                }
                Tbl_LoginMaster loginObj = new Tbl_LoginMaster();
                loginObj.Email     = obj.Mail1;
                loginObj.UserName  = (string.IsNullOrEmpty(obj.Mail1) ? obj.Mob1 : obj.Mail1);
                loginObj.Password  = "******";
                loginObj.IsClient  = true;
                loginObj.CilientID = obj.ClientID;
                db.Tbl_LoginMaster.Add(loginObj);
                db.SaveChanges();
            }
        }