Ejemplo n.º 1
0
        //[Route("login", Name = "Login")]
        public async Task <IHttpActionResult> Login(UserLogin userLogin)
        {
            MDTTransactionInfo transactionInfo = null;
            Logger             Log             = new Logger();

            transactionInfo = await Task.Run(() =>
            {
                try
                {
                    if (userLogin == null)
                    {
                        Log.WriteErrorLog("userLogin object have no value or null");
                    }
                    return(_iUserLogin.Login(userLogin));
                }
                catch (Exception ex)
                {
                    Log.WriteErrorLog(ex.Message + "<br/>" + Environment.NewLine + "StackTrace :" + ex.StackTrace +
                                      "" + Environment.NewLine);
                    Log.WriteErrorLog(Environment.NewLine + "-----------------------------------------------------------------------------" + Environment.NewLine);

                    return(new MDTTransactionInfo {
                        msgCode = MessageCode.Failed, message = ex.Message, status = HttpStatusCode.InternalServerError
                    });
                }
            });

            return(Ok(transactionInfo));
        }
        public void UserLogin()
        {
            Console.WriteLine("Please Enter the employee Id");
            int id = Convert.ToInt32(Console.ReadLine());

            Console.WriteLine("Please enter the password");
            string   password = Console.ReadLine();
            Employee employee = new Employee();

            employee.Id       = id;
            employee.Password = password;
            try
            {
                if (_Login.Login(employee))
                {
                    Console.WriteLine("Welcome");
                }
                else
                {
                    Console.WriteLine("Incorrect credintals");
                }
            }
            catch (Exception e)
            {
                Console.WriteLine("login exception");
                Console.WriteLine(e.Message);
            }
        }
Ejemplo n.º 3
0
        public async Task <object> Login([FromBody] LoginModel model)
        {
            if (!ModelState.IsValid)
            {
                return(null); // BadRequest ???
            }

            return(await _userLogin.Login(model, _userManager, _signInManager, _configuration));
        }
 public async Task <UserViewModel> Post([FromBody] UserLoginModel userLoginModel)
 {
     return(await _userLogin.Login(userLoginModel));
 }
Ejemplo n.º 5
0
 public void Login()
 {
     userLogin.Login();
 }