Beispiel #1
0
        public async Task <HttpResponseMessage> AuthenticateUserAsync(string username, string password)
        {
            ICommand command = new QueryCommand();
            var      role    = await command.AuthenticateUserAsync(username, password);

            if (role != null)
            {
                var message = "Successfully authenticated";

                return(Request.CreateResponse <ResponseMessage <Role> >(HttpStatusCode.OK,
                                                                        new ResponseMessage <Role>
                {
                    Status = true,
                    ReturnMessage = message,
                    ReturnResult = role
                }));
            }

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