Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- [HttpPost]
- [ActionName("USER_REG")]
- // POST: api/Login
- public HttpResponseMessage Xamarin_reg(Login log)
- {
- try
- {
- Login login = new Login();
- login.AdSoyad = log.AdSoyad;
- login.Mail = log.Mail;
- login.Password = log.Password;
- login.HesapTuru = log.HesapTuru;
- db.Logins.Add(login);
- db.SaveChanges();
- return Request.CreateResponse(HttpStatusCode.Accepted, "Successfully Created");
- }
- catch (Exception ex)
- {
- return Request.CreateResponse(HttpStatusCode.ExpectationFailed, ex.ToString());
- }
- }
- [HttpGet]
- [ActionName("XAMARIN_Login")]
- // GET: api/Login/5
- public HttpResponseMessage Xamarin_Login(string username, string password)
- {
- var user = db.Logins.Where(x => x.UserName == username && x.Password == password).FirstOrDefault();
- if (user == null)
- {
- return Request.CreateResponse(HttpStatusCode.Unauthorized, "Please Enter valid UserName and Password");
- }
- else
- {
- return Request.CreateResponse(HttpStatusCode.Accepted, "Success");
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement