Advertisement
Guest User

Untitled

a guest
Apr 11th, 2016
115
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.83 KB | None | 0 0
  1. using DAL;
  2. using System;
  3. using System.Collections.Generic;
  4. using System.Linq;
  5. using System.Web;
  6. using System.Web.Mvc;
  7. using Whiteboard.Models;
  8.  
  9. namespace Whiteboard.Controllers
  10. {
  11. public class AccountController : Controller
  12. {
  13. // GET: Account
  14. //
  15. // GET: /Account/Register
  16. [AllowAnonymous]
  17. public ActionResult RegisterUser()
  18. {
  19. return View();
  20. }
  21. [HttpPost]
  22. [AllowAnonymous]
  23. [ValidateAntiForgeryToken]
  24. public ActionResult RegisterUser(UserModel model)
  25. {
  26. var userRep = new UserRepository();
  27. var user = new User();
  28. {
  29. user.Email = model.Email;
  30. user.Password = model.Password;
  31. user.Firstname = model.Firstname;
  32. user.Lastname = model.Lastname;
  33. user.Phonenumber = model.PhoneNumber;
  34. user.ResearchAdmin = model.ResearchAdmin;
  35. user.EducationAdmin = model.EducationAdmin;
  36. user.Doctorand = model.Doctorand;
  37. user.Lecturer = model.Lecturer;
  38. user.Researcher = model.Researcher;
  39.  
  40. }
  41. userRep.addUser(user);
  42. return View();
  43. }
  44. public ActionResult LoginUser()
  45. {
  46. return View();
  47. }
  48.  
  49. [HttpPost]
  50. [AllowAnonymous]
  51. public ActionResult LoginUser(UserModel model)
  52. {
  53. var userRepository = new UserRepository();
  54. var lowerEmail = model.Email.ToLower();
  55.  
  56.  
  57. if (userRepository.checkUserLogin(lowerEmail, model.Password))
  58. {
  59.  
  60. return RedirectToAction("Index", "Home");
  61. }
  62. return RedirectToAction("index", "Home");
  63. }
  64.  
  65. }
  66. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement