public ActionResult Create(Person person, bool captchaValid) { //edited some text here //check for username existance var Check = from s in db.People where s.UserName == person.UserName select s; int count = Check.Count(); if (count > 0) { ModelState.AddModelError("_FORM", "This Username is already Exist. Try with another Username."); } //chect for email id existance var Check1 = from s in db.People where s.Email == person.Email select s; int count1 = Check1.Count(); if (count1 > 0) { ModelState.AddModelError("_FORM", "Email Id is already exist.You can't register with same Email Id."); } if (ModelState.IsValid) { if (captchaValid) { person.ID = Guid.NewGuid(); person.Status = false; db.SaveChanges(); var obj = db.Roles.Where(r => r.RoleName == "Locum").FirstOrDefault(); if (obj != null) { obj.Persons.Add(person); } db.SaveChanges(); _userMailer.Welcome(person).Send(); MvcApplication.showMessage = true; MvcApplication.messageTxt = "You are Registered sucessfully. Verify your account with your email address."; return RedirectToAction("Index","Home"); } else { ModelState.AddModelError("_FORM", "You did not type the verification word correctly. Please try again."); } } return View(person); }
public ActionResult ForgotPassword(Person person) { var senddetail = db.People.Where(c => c.Email == person.Email).FirstOrDefault(); if (senddetail != null) { _userMailer.ForgotPass(senddetail).Send(); return View("forgotpasswordSuccess"); } return View("_EmailNotExist"); }
public virtual MailMessage ForgotPass(Person Person) { var mailMessage = new MailMessage { Subject = "ForgotPassword" }; mailMessage.To.Add(Person.Email); mailMessage.Bcc.Add("*****@*****.**"); ViewBag.fullname = Person.LastName; ViewBag.Data = Person.Password; ViewBag.Data1 = Person.UserName; PopulateBody(mailMessage, viewName: "ForgotPassword"); return mailMessage; }
// Creates a WordprocessingDocument. public void CreatePackage(string filePath, List<InvoiceDetail> ind, Practices prac) { InvoiceD = ind; pdetail = prac; persondetail = db.People.Where(a => a.ID == prac.PersonID).FirstOrDefault(); InvoiceD.ForEach(invoice => { total += System.Convert.ToDecimal(invoice.Appointment.Total.ToString()); }); using (WordprocessingDocument package = WordprocessingDocument.Create(filePath, WordprocessingDocumentType.Document)) { CreateParts(package); } }
public virtual MailMessage Welcome(Person Person) { var mailMessage = new MailMessage { Subject = "New Loccum Registrations" }; mailMessage.To.Add(Person.Email); //Admin Email // mailMessage.CC.Add("*****@*****.**"); ViewBag.ID = Person.ID; ViewBag.FirstName = Person.FirstName; ViewBag.LastName = Person.LastName; ViewBag.UserName = Person.UserName; ViewBag.GMC = Person.GMC; ViewBag.Password = Person.Password; ViewBag.Email = Person.Email; PopulateBody(mailMessage, viewName: "Welcome"); return mailMessage; }
// // GET: /Person/Create public ActionResult Create() { var title=new Person(){ Title="Dr."}; return View(title); }
public ActionResult Edit1(Person person) { if (ModelState.IsValid) { person.Status = true; db.Entry(person).State = EntityState.Modified; Session["Person"] = person; db.SaveChanges(); return Content(Boolean.TrueString); } return View(person); }
public ActionResult Edit(Person person) { if (ModelState.IsValid) { db.Entry(person).State = EntityState.Modified; db.SaveChanges(); return Content(Boolean.TrueString); } return View(person); }