public void Delete(MembroModel item) { Server s = Server.Instance(); Database local = new Database("local", s); Collection <MembroModel> membros = new Collection <MembroModel>("membros", local); var infras = new Infracao().FindAll(x => x.IdInfrator == item.DiscordId); infras.ForEach(x => new Infracao().Delete(x)); membros.DeleteDocument(x => x.Id == item.Id); }
public void Delete(PrisaoModel item) { Server s = Server.Instance(); Database local = new Database("local", s); Collection <PrisaoModel> prisao = new Collection <PrisaoModel>("prisao", local); Collection <InfracaoModel> infracoes = new Collection <InfracaoModel>("infra", local); InfracaoModel infra = new Infracao().Find(x => x.PrisaoId == item.Id); infra.PrisaoId = 0; infra.Preso = false; infracoes.UpdateDocument(x => x.Id == infra.Id, infra); prisao.DeleteDocument(x => x.Id == item.Id); }
public void Insert(PrisaoModel item) { int i = GetLastId(); i++; item.Id = i; Server s = Server.Instance(); Database local = new Database("local", s); Collection <PrisaoModel> prisao = new Collection <PrisaoModel>("prisao", local); Collection <InfracaoModel> infracoes = new Collection <InfracaoModel>("infra", local); InfracaoModel infra = new Infracao().Find(x => x.Id == item.InfraId); infra.PrisaoId = item.Id; infra.Preso = true; infracoes.UpdateDocument(x => x.Id == infra.Id, infra); prisao.InsertDocument(item); }