public User Get(string email, string password) { UsersBusiness usersBusiness = new UsersBusiness(sqlConnection); User u = usersBusiness.GetByEmailAndPassword(email, password); if(u == null) { throw new ApiException(HttpStatusCode.NotFound, "User with supplied information was not found in DB."); } else if(u.Id == 0) { throw new ApiException(HttpStatusCode.BadRequest, "Supplied parameters are malformed"); } return u; }
UsersController() { sqlConnection = new SqlConnection(ConfigurationManager.ConnectionStrings["ReleaseTrackerDbConnection"].ConnectionString); usersBusiness = new UsersBusiness(sqlConnection); }