public IActionResult CheckAuth([FromBody] CaffeAuth auth) { try { if (unit.Auth.CombinationExists(auth)) { return(Ok("Combination exists.")); } return(NotFound()); } catch (Exception ex) { return(BadRequest("Failed to add bill drink, " + ex.ToString())); } }
public IActionResult Login(int id, [FromBody] CaffeAuth auth) { try { var isThere = unit.Auth.CombinationExists(auth); if (isThere) { return(Ok(auth)); } return(NotFound()); } catch (Exception ex) { return(BadRequest("Failed to update table, " + ex.ToString())); } }
public bool CombinationExists(CaffeAuth auth) { var count = context.Auth.Where(x => x.Username == auth.Username && x.Password == auth.Password).Count(); return(count == 1 ? true : false); }