Пример #1
0
 public ActionResult Register(Entity.PersonEntity personEntity)
 {
     ViewBag.IsAuthenticated = false;
     personEntity.joined     = DateTime.Now;
     _ITwitterClone.AddUser(personEntity);
     return(View());
 }
Пример #2
0
 public ActionResult Login(Entity.PersonEntity model, string returnUrl)
 {
     if (ModelState.IsValid)
     {
         var person = new Entity.PersonEntity()
         {
             user_id  = model.user_id,
             password = model.password
         };
         if (_ITwitterClone.LoginUser(person))
         {
             Session["UserName"] = model.user_id;
             return(RedirectToAction("Index", "Home"));
         }
         else
         {
             ModelState.AddModelError("", "Invalid login attempt.");
             return(View(model));
         }
     }
     else
     {
         ModelState.AddModelError("", "Invalid login attempt.");
         return(View(model));
     }
 }