public Response <int> Update(Usuario usuario) { try { Response <int> response = new Response <int>(); using (DapperManager dapper = new DapperManager(_config.GetConnectionString(keyDB))) { var result = dapper.Update(usuario); response.ResultData = new Collection <int>() { result }; response.ResponseCode = (int)HttpStatusCode.OK; response.ResponseMessage = "Usuario actualizado exitósamente"; } return(response); } catch (Exception ex) { return(new Response <int> { ResponseCode = (int)HttpStatusCode.BadRequest, ResponseMessage = ex.Message, ResultData = null }); } }
public Response <Usuario> Get() { Collection <Usuario> clientes = new Collection <Usuario>(); try { using (DapperManager dapper = new DapperManager(_config.GetConnectionString(keyDB))) { clientes = dapper.Get(); } Response <Usuario> response = new Response <Usuario>() { ResponseCode = (int)HttpStatusCode.OK, ResponseMessage = "OK", ResultData = clientes }; return(response); } catch (Exception ex) { return(new Response <Usuario> { ResponseCode = (int)HttpStatusCode.BadRequest, ResponseMessage = ex.Message, ResultData = null }); } }