Advertisement
Guest User

Untitled

a guest
Aug 20th, 2019
92
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.89 KB | None | 0 0
  1. public ActionResult Create(Registration registration)
  2. {
  3. if (ModelState.IsValid)
  4. {
  5. registration.ConfirmPassword = EncryptionLibrary.EncryptText(registration.ConfirmPassword);
  6. registration.Password= EncryptionLibrary.EncryptText(registration.Password);
  7. registration.Created_Date = DateTime.Now;
  8.  
  9. if (ModelState.IsValid)
  10. {
  11. db.Registration.Add(registration);
  12. db.SaveChanges();
  13. ViewBag.teacher = "Teacher account has been created Successfully";
  14. return RedirectToAction("Create");
  15. }
  16.  
  17. TempData["Faculty"] = "";
  18. var result = _IRegistration.AddFaculty(registration);
  19.  
  20. if (result > 0)
  21. {
  22. TempData["Success"] = "Faculty Added Successfully";
  23. ModelState.Clear();
  24. return RedirectToAction("Create");
  25. }
  26. }
  27. return View(registration);
  28. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement