AbidMufasa

LogInController

Jul 30th, 2017
34
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.83 KB | None | 0 0
  1. using CRUDOperationAJAX.Models;
  2. using System;
  3. using System.Collections.Generic;
  4. using System.Linq;
  5. using System.Web;
  6. using System.Web.Mvc;
  7.  
  8. namespace CRUDOperationAJAX.Controllers
  9. {
  10.     public class LogInController : Controller
  11.     {
  12.         // GET: LogIn
  13.         public ActionResult Index()
  14.         {
  15.             return View();
  16.         }
  17.         [HttpPost]
  18.         public ActionResult Index(string UserName, string Password)
  19.         {
  20.             UserDB usrDB = new UserDB();
  21.             var chk = usrDB.ListAll().Where(x => x.UserName == UserName && x.Password == Password).FirstOrDefault();
  22.             if (chk != null)
  23.                 return Redirect("Home");
  24.             else
  25.                 return View();
  26.         }
  27.  
  28.         public ActionResult IndexUser()
  29.         {
  30.  
  31.             return View();
  32.         }
  33.     }
  34. }
Add Comment
Please, Sign In to add comment