コード例 #1
0
ファイル: UnitController.cs プロジェクト: AleX77NP/CaffeBar
 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()));
     }
 }
コード例 #2
0
ファイル: UnitController.cs プロジェクト: AleX77NP/CaffeBar
 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()));
     }
 }
コード例 #3
0
ファイル: AuthRepository.cs プロジェクト: AleX77NP/CaffeBar
        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);
        }