Advertisement
Guest User

Untitled

a guest
Sep 2nd, 2016
94
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.28 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Data;
  4. using System.Data.Entity;
  5. using System.Data.Entity.Infrastructure;
  6. using System.Linq;
  7. using System.Net;
  8. using System.Net.Http;
  9. using System.Web.Http;
  10. using System.Web.Http.Description;
  11. using WebFormsDemo;
  12. using WebFormsDemo.ViewModel;
  13. using System.Security.Cryptography;
  14. using System.Web.Helpers;
  15. using Microsoft.AspNet.Identity;
  16. using Microsoft.AspNet.Identity.Owin;
  17. using Microsoft.Owin.Security;
  18. using Microsoft.AspNet.Identity.EntityFramework;
  19.  
  20.  
  21. namespace WebFormsDemo.Controllers
  22. {
  23. public class LoginController : ApiController
  24. {
  25. private EBMSEntities db = new EBMSEntities();
  26.  
  27. [Route("api/Login/Search/{username}/{password}")]
  28. [ResponseType(typeof(List<AspNetUser>))]
  29.  
  30.  
  31. public bool getUserPassword(string username, string password)
  32.  
  33. {
  34.  
  35. var hashedPassword = "";
  36. hashedPassword = Crypto.HashPassword(password);
  37.  
  38.  
  39. var user = (from u in db.AspNetUsers
  40. where u.UserName.Equals(username)
  41. && u.PasswordHash.Equals(hashedPassword)
  42. select u).ToList();
  43.  
  44. if (user.Count() != 0)
  45. {
  46. return true;
  47. }
  48.  
  49. return false;
  50.  
  51.  
  52. }
  53.  
  54. }
  55. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement