Пример #1
0
        public IActionResult Login([FromBody] Client client)
        {
            try
            {
                string PASSWORD = "";

                try
                {
                    Client cli = _repository.SearchAccount(client.ACCOUNT);
                    PASSWORD = cli.PASSWORD;

                    if (cli.STATUS == "0")
                    {
                        return(StatusCode(403, "This account is inactived"));
                    }

                    if (PASSWORD == "" || PASSWORD == string.Empty)
                    {
                        return(StatusCode(404, "Account not found"));
                    }
                }
                catch (Exception)
                {
                    return(StatusCode(404, "Account not found"));
                }


                if (PASSWORD == client.PASSWORD)
                {
                    NotifyClient(client, "We inform that someone just logged on your account!");
                    return(StatusCode(200, "Welcome"));
                }
                else
                {
                    return(StatusCode(403, "Invalid Credentials"));
                }
            }
            catch (Exception)
            {
                return(StatusCode(500, "We had an unknown error"));
            }
        }