Advertisement
Guest User

Untitled

a guest
Aug 19th, 2017
91
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.19 KB | None | 0 0
  1. [HttpPost]
  2. [ActionName("USER_REG")]
  3. // POST: api/Login
  4. public HttpResponseMessage Xamarin_reg(Login log)
  5. {
  6. try
  7. {
  8. Login login = new Login();
  9. login.AdSoyad = log.AdSoyad;
  10. login.Mail = log.Mail;
  11. login.Password = log.Password;
  12. login.HesapTuru = log.HesapTuru;
  13. db.Logins.Add(login);
  14. db.SaveChanges();
  15. return Request.CreateResponse(HttpStatusCode.Accepted, "Successfully Created");
  16. }
  17. catch (Exception ex)
  18. {
  19. return Request.CreateResponse(HttpStatusCode.ExpectationFailed, ex.ToString());
  20. }
  21.  
  22. }
  23.  
  24.  
  25. [HttpGet]
  26. [ActionName("XAMARIN_Login")]
  27. // GET: api/Login/5
  28. public HttpResponseMessage Xamarin_Login(string username, string password)
  29. {
  30. var user = db.Logins.Where(x => x.UserName == username && x.Password == password).FirstOrDefault();
  31. if (user == null)
  32. {
  33. return Request.CreateResponse(HttpStatusCode.Unauthorized, "Please Enter valid UserName and Password");
  34. }
  35. else
  36. {
  37. return Request.CreateResponse(HttpStatusCode.Accepted, "Success");
  38. }
  39. }
  40.  
  41. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement