Posts

Showing posts from December 10, 2018

Restful Service in Asp.net fetching information

Image
up vote 0 down vote favorite The problem is this code is getting username and password from the whole table like if i enter username of first person and password of second person this code still fetching information but i want to fetch only one user info with same username and password please help me. [System.Web.Http.AcceptVerbs("GET","POST")] [HttpGet] public User Login(string username, string password) { if (string.IsNullOrEmpty(username) || string.IsNullOrEmpty(password)) return null; var user = db.Users.SingleOrDefault(x => x.Email == username); var pass = db.Users.SingleOrDefault(x => x.Password == password); if (user == null || pass==null ) return null; return user; }