예제 #1
0
 public static bool Delete(TypeOfCost TypeOfCost)
 {
     try
     {
         DB.TypeOfCost.DeleteOne(x => x.id == TypeOfCost.id);
         return(true);
     }
     catch (Exception e)
     {
         throw new Exception("Erro delete TypeOfCost :" + e.ToString());
     }
 }
예제 #2
0
 public static bool Update(TypeOfCost TypeOfCost)
 {
     try
     {
         DB.TypeOfCost.ReplaceOne(c => c.id == TypeOfCost.id, TypeOfCost);
         return(true);
     }
     catch (Exception e)
     {
         throw new Exception("Erro Update TypeOfCost :" + e.ToString());
     }
 }
예제 #3
0
        public static bool Insert(string name)
        {
            try
            {
                var        t       = GetAll();
                int        val     = t.Count();
                TypeOfCost newuser = new TypeOfCost(name, val);
                DB.TypeOfCost.InsertOne(newuser);

                return(true);
            }
            catch (Exception e)
            {
                throw new Exception("Erro Inserir Fornecedor" + e.ToString());
            }
        }
예제 #4
0
        public static TypeOfCost Get(string name)
        {
            try
            {
                TypeOfCost tipocusto = DB.TypeOfCost.Find(x => x.name == name).FirstOrDefault();
                if (tipocusto != null)
                {
                    return(tipocusto);
                }

                return(null);
            }
            catch (Exception e)
            {
                throw new Exception("Erro Inserir Utilizador" + e.ToString());
            }
        }