Ejemplo n.º 1
0
 public ActionResult Authorize(Reciklaza.Data.Models.Admin adminModel)
 {
     using (ReciklazaContext db = new ReciklazaContext())
     {
         var adminDetails = db.Admins.Where(x => x.Username == adminModel.Username && x.Password == adminModel.Password).FirstOrDefault();
         if (adminDetails == null)
         {
             adminModel.LoginErrorMessage = "Nije dobar username ili password.";
             return(View("Login", adminModel));
         }
         else
         {
             Session["Id"] = adminDetails.Id;
             return(RedirectToAction("Index", "Home"));
         }
     }
 }