Exemple #1
0
        public async Task <HttpResponseMessage> AuthenticateUser(string username, string password)
        {
            ICommand command = new QueryCommand();
            var      status  = await command.AuthenticateAsync(username, password);

            if (status)
            {
                var message = "Successfully authenticated";
                return(Request.CreateResponse <ResponseMessage>(HttpStatusCode.OK,
                                                                new ResponseMessage
                {
                    Status = true,
                    ReturnMessage = message
                }));
            }

            return(Request.CreateResponse <ResponseMessage>(HttpStatusCode.OK,
                                                            new ResponseMessage
            {
                Status = false,
                ReturnMessage = "This user does not exist"
            }));
        }