public bool Delete(ProjectoTT proj) { try { DB.ProjectoTT.DeleteOne(x => x.Id == proj.Id); return(true); } catch (Exception e) { throw new Exception("Erro delete Projecto :" + e.ToString()); } }
public bool Insert(Estado estado, string sigav, string nome, string p_descricao, string ClienteId, string Cliente, string AccountManagerId, string AccountManager, string DesignerId, string Designer, DateTime dataentrada, string NomeContacto) { try { ProjectoTT newObj = new ProjectoTT(estado, sigav, nome, p_descricao, ClienteId, Cliente, AccountManagerId, AccountManager, DesignerId, Designer, dataentrada, NomeContacto); DB.ProjectoTT.InsertOne(newObj); return(true); } catch (Exception e) { throw new Exception("Erro Inserir Projecto : " + e.ToString()); } }
public static bool Insert(ProjectoTT proj, out string id) { try { DB.ProjectoTT.InsertOne(proj); id = proj.Id.ToString(); return(true); } catch (Exception e) { throw new Exception("Erro Inserir Projecto : " + e.ToString()); } }
public static bool Update(ProjectoTT proj, string projectoid) { try { ObjectId neid = new ObjectId(projectoid); proj.Id = neid; DB.ProjectoTT.ReplaceOne(c => c.Id == neid, proj); return(true); } catch (Exception e) { throw new Exception("Erro Update Projecto :" + e.ToString()); } }