Advertisement
Guest User

Untitled

a guest
Aug 24th, 2016
62
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.18 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.  
  16. namespace WebFormsDemo.Controllers
  17. {
  18. public class LoginController : ApiController
  19. {
  20. private EBMSEntities db = new EBMSEntities();
  21.  
  22. // GET: api/Login
  23.  
  24. [Route("api/Login/Search/{username}/{password}")]
  25. [ResponseType(typeof(List<AspNetUser>))]
  26.  
  27. public bool getUserPassword(string username, string password)
  28.  
  29. {
  30.  
  31. var hashedPassword = "";
  32. hashedPassword = password;
  33.  
  34.  
  35. var user = (from u in db.AspNetUsers
  36. where u.UserName.Equals(username)
  37. && u.PasswordHash.Equals(hashedPassword)
  38. select u).ToList();
  39.  
  40.  
  41.  
  42. if (user.Count() != 0)
  43. {
  44. return true;
  45. }
  46.  
  47. return false;
  48.  
  49. }
  50.  
  51. }
  52. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement