Beispiel #1
0
    public async Task <ActionResult <dynamic> > Login([FromBody] AutenticationModel model)
    {
        try
        {
            model.IsCustomValid();
            var userAuth = await _service.Login(model);

            return(Ok(new { token = userAuth.Token }));
        }
        catch (Exception e)
        {
            return(BadRequest(e.Data));
        }
    }
Beispiel #2
0
    public async Task <ActionResult <dynamic> > Login([FromBody] AutenticationModel model)
    {
        try
        {
            model.IsCustomValid();
            var userAuth = _service.Login(model);
            var token    = await Token.GenerateToken(model);

            return(new { token = token });
        }
        catch (Exception e)
        {
            return(BadRequest(e.Message));
        }
    }