public int BorrarUsuario(BorradoDTO usuario) { LoginDTO user = usersRepository.GetUsersByEmail(usuario.Email); var result = 0; if (user != null) { var id = user.id; string SqlString = $@" DELETE FROM [Usuario] WHERE [id] = @id "; result = _db.Execute(SqlString, new { id = id }); } var mykey = "listUsers"; if (_cacheService.IsExists(mykey)) { _cacheService.IsExistsDelete(mykey); log.Info("Delete Cache Redis - BorrarUsuario"); } return(result); }
public async Task <IActionResult> DeleteUsuario(BorradoDTO usuario) { try { if (String.IsNullOrEmpty(usuario.Email)) { ResponseDto response = new ResponseDto { data = "", message = "El email no puede estar en blanco", result = false }; return(BadRequest(response)); } return(Ok(await Task.FromResult(_UsersService.BorrarUsuario(usuario)).ConfigureAwait(false))); } catch (Exception err) { log.Error("LoginController-DeleteUsuario"); ResponseDto response = new ResponseDto { data = "", message = err.Message, result = false }; return(BadRequest(response)); } }