public void guardarInforme(string listaFormularios, string idAsada) { Database.Connection.OpenAsync(); var query = new FormularioInforme(Database); int idUser = Autenticacion.get_idUsuario(); string nombre = obtenerNombreAsada(idAsada); long date = DateTimeOffset.UtcNow.ToUnixTimeSeconds(); query.guardarInforme(nombre, listaFormularios, date); string idInforme = query.getLastInserted(); query.guardarUsuarioxInforme(idUser, idInforme); }
public IActionResult GetUsers(string USER, string PASSWORD) { Database.Connection.OpenAsync(); var query = new LoginModel(Database); var result = query.credentialsValidate(USER, PASSWORD); if (Autenticacion.get_idUsuario() != -1) { var result1 = query.GetAsadas(); } var r = new OkObjectResult(result); if (!r.Equals("")) { var identity = new ClaimsIdentity(CookieAuthenticationDefaults.AuthenticationScheme, ClaimTypes.Name, ClaimTypes.Role); identity.AddClaim(new Claim(ClaimTypes.NameIdentifier, result[0].id.ToString())); identity.AddClaim(new Claim(ClaimTypes.Name, result[0].tipo.ToString())); var principal = new ClaimsPrincipal(identity); HttpContext.SignInAsync(CookieAuthenticationDefaults.AuthenticationScheme, principal, new AuthenticationProperties { ExpiresUtc = DateTime.Now.AddDays(1), IsPersistent = true }); } return(new OkObjectResult(result)); }