public ActionResult Signup() { Models.UsersTable u = new Models.UsersTable(); //u.UserId =Convert.ToInt32(Request["UserId"]); u.Login = Request["name"]; u.Password = Request["Password"]; u.Designation = Request["Designation"]; u.Email = Request["Email"]; u.isActive = true /*Convert.ToBoolean(Request["isActive"])*/; u.UsersType = 2 /*Convert.ToInt32(Request["UsersType"])*/; var obj = UserBO.Save(u); if (obj > 0) { return(Content("<script>alert('Thanks for Registering!');document.location='NormalUser'</script>")); //return Content("<script language='javascript' type='text/javascript'>alert('Thanks for Registering!');</script>"); // int i = 0; // Session["user"] = obj; } else { return(Content("<script>alert('invalid user name or password');document.location='login'</script>")); } // return View(); }
public JsonResult Save(Models.UsersTable u) { //u.UserId =Convert.ToInt32(Request["UserId"]); u.Login = Request["name"]; u.Password = Request["Password"]; u.Designation = Request["Designation"]; u.Email = Request["Email"]; u.isActive = true /*Convert.ToBoolean(Request["isActive"])*/; u.UsersType = 1 /*Convert.ToInt32(Request["UsersType"])*/; var uniqueName = ""; if (Request.Files["Image"] != null) { var file = Request.Files["Image"]; if (file.FileName != "") { var ext = System.IO.Path.GetExtension(file.FileName); //Generate a unique name using Guid uniqueName = Guid.NewGuid().ToString() + ext; //Get physical path of our folder where we want to save images var rootPath = Server.MapPath("~/UploadedFiles"); var fileSavePath = System.IO.Path.Combine(rootPath, uniqueName); // Save the uploaded file to "UploadedFiles" folder file.SaveAs(fileSavePath); u.PictureName = uniqueName; } } //if (dto.ProductID > 0) //{ // dto.ModifiedOn = DateTime.Now; // dto.ModifiedBy = "1"; //} //else //{ // dto.CreatedOn = DateTime.Now; // dto.CreatedBy = "1"; //} var pid = UserBO.Save(u); var data = new { success = true, ProductID = pid, PictureName = u.PictureName }; return(Json(data, JsonRequestBehavior.AllowGet)); }
public ActionResult SignupUser() { Models.UsersTable u = new Models.UsersTable(); //u.UserId =Convert.ToInt32(Request["UserId"]); u.Login = Request["name"]; u.Password = Request["Password"]; u.Designation = Request["Designation"]; u.Email = Request["Email"]; u.isActive = true /*Convert.ToBoolean(Request["isActive"])*/; u.UsersType = 2 /*Convert.ToInt32(Request["UsersType"])*/; var obj = UserBO.Save(u); if (obj > 0) { return(Content("<script>alert('thanks for registering!!!');document.location='NormalUser'</script>")); // int i = 0; // Session["user"] = obj; } else { return(Content("<script>alert('registering unsuccessful!!!');document.location='login'</script>")); } }