public JsonResult ApproveEpins() { List <string> li = new List <string>(); try { var epr = db.ePinRequests.ToArray(); foreach (var item in epr) { for (int i = 0; i < item.Qty; i++) { ePinCode ObjePinCode = new ePinCode(); ObjePinCode.DateAdded = DateTime.Now; ObjePinCode.ePinRequestId = item.Id; Guid guid = Guid.NewGuid(); ObjePinCode.PCode = guid.ToString().Substring(0, 32); db.ePinCodes.Add(ObjePinCode); db.SaveChanges(); } var ObjePinRequest = item; ObjePinRequest.IsApproved = true; ObjePinRequest.ApprovedBy = int.Parse(Env.GetUserInfo("userid")); db.Entry(ObjePinRequest).State = EntityState.Modified; db.SaveChanges(); } li.Add("Done"); } catch (Exception) { li.Add("Error"); } return(Json(li, JsonRequestBehavior.AllowGet)); }
public ActionResult register(System.Web.Mvc.FormCollection frmCollection) { User user = new User(); user.Username = frmCollection["name"]; user.Password = frmCollection["password2"]; user.Email = frmCollection["email"]; var parent = frmCollection["parent"]; var sponser = frmCollection["sponser"]; if (db.Users.Where(u => u.Username == user.Username).SingleOrDefault() != null) { ViewBag.Msg = "Username already taken."; return(View()); } User userparent = db.Users.Where(u => u.Username == parent).SingleOrDefault(); User usersponser = db.Users.Where(u => u.Username == sponser).SingleOrDefault(); if (userparent == null || usersponser == null) { ViewBag.Msg = "Parent or Sponser doesn't exist"; return(View()); } else { user.ParentId = userparent.Id; user.SponserId = usersponser.Id; } user.MemberShipLevelId = 1; db.Users.Add(user); db.SaveChanges(); //REGISTER USER ROLE RoleUser roleuser = new RoleUser(); roleuser.RoleId = 2; roleuser.UserId = user.Id; db.RoleUsers.Add(roleuser); db.SaveChanges(); string To = user.Email, UserID, Password, SMTPPort, Host; var lnkHref = "<a href='http://incomeplant.azurewebsites.net/Account/login'>Click this to login your account</a>"; string subject = "Welcome To Income Plant"; string body = "<b>Congratulation!!! <br/> Your account has been successfully created.<br/> We warmly welcome you to our family and appreciate your interest for joining us.</b><br/>" + "</br>" + lnkHref + "<br/>" + "<p>If you did not make this request then you can simply ignore this email.</p><br/><p>Thanks,<br/><br/><b>Incomeplant Support</b></p>" + "<hr>" + "<img src='http://incomeplant.com/images/header-logo.png'/>" + "<br/>" + "<b>Telephone:</b> +91-8218-041-593 <p><b>Website: </b>http://incomeplant.com/</p>" + "<br/>" + "<p style='font-size: 10px;'><b>Address:</b>Harora Road, Simbhaoli, Hapur-245207</p></br><p style='font-size: 10px;'><b>Disclaimer:</b> This message (and any attachments) is private and confidential and may contain personal data or personal views which are not the views of Incomeplant unless specifically stated. If you have received this message in error, please notify us and remove it from your system. Do not use, copy or disclose the information in any way.</p>"; //Get and set the AppSettings using configuration manager. emailmanager.Appsettings(out UserID, out Password, out SMTPPort, out Host); //Call send email methods. emailmanager.SendEmail(UserID, subject, body, To, UserID, Password, SMTPPort, Host); ViewBag.Msg = "Register Successfully! "; return(View()); }
//[HttpPost] public ActionResult Feedback(string content) { if (string.IsNullOrWhiteSpace(content)) { return(Json( new { success = false, text = "Bạn đã phản hồi nội dung rỗng" }, JsonRequestBehavior.AllowGet)); } db.Feeds.Add(new FeedbackModel { Content = content }); db.SaveChanges(); return(Json( new { success = true, text = "Cảm ơn bạn đã gửi phản hồi về cho chúng tôi." + " Chúng tôi sẽ cải thiện website tốt hơn dựa trên phản hồi từ bạn. ^^" }, JsonRequestBehavior.AllowGet)); }
public ActionResult AddSymbols(int fontId, List <string> symbolsInXUTF) { if (!Verifier.CheckLogin(Request)) { return(RedirectToAction("Login", new { url = Request.Url.AbsoluteUri })); } var font = db.Fonts.Find(fontId); if (font == null) { return(HttpNotFound("font id was not found")); } foreach (var child in symbolsInXUTF) { if (child == null) { continue; } db.Symbols.Add( new Symbol { FontId = fontId, Content = child }); } db.SaveChanges(); ViewData["fontCurrent"] = font; ViewData["symbols"] = db.Symbols.Where(x => x.FontId == font.Id).ToList(); return(PartialView("_FontSymbolsTBody")); }
public ActionResult register(System.Web.Mvc.FormCollection frmCollection) { ApplicationUser user = new ApplicationUser(); user.Username = frmCollection["name"]; user.Password = frmCollection["password2"]; db.ApplicationUsers.Add(user); //REGISTER USER ROLE RoleUser roleuser = new RoleUser(); roleuser.RoleId = 1; roleuser.UserId = user.Id; db.RoleUsers.Add(roleuser); db.SaveChanges(); ViewBag.Msg = "Register Successfully"; return(View()); }