Пример #1
0
 public bool DeleteProp(Prop prop)
 {
     try
     {
         bool wasDeleted = false;
         if (prop != null)
         {
             VestnDB db = new VestnDB();
             db.prop.Attach(prop);
             db.prop.Remove(prop);
             db.SaveChanges();
             wasDeleted = true;
             return wasDeleted;
         }
         else
         {
             return wasDeleted;
         }
     }
     catch (Exception e)
     {
         logAccessor.CreateLog(DateTime.Now, "userAccessor - deleteExperience", e.StackTrace);
         return false;
     }
 }
Пример #2
0
 public Prop AddProp(Prop prop)
 {
     try
     {
         if (prop != null)
         {
             VestnDB db = new VestnDB();
             db.prop.Add(prop);
             db.SaveChanges();
             return prop;
         }
         else
         {
             return null;
         }
     }
     catch (Exception e)
     {
         logAccessor.CreateLog(DateTime.Now, "PropAccessor - AddProp", e.StackTrace);
         return null;
     }
 }
Пример #3
0
 public Prop UpdateProp(Prop prop)
 {
     try
     {
         if (prop != null)
         {
             VestnDB db = new VestnDB();
             db.Entry(prop).State = EntityState.Modified;
             db.SaveChanges();
             return prop;
         }
         else
         {
             return null;
         }
     }
     catch (Exception e)
     {
         logAccessor.CreateLog(DateTime.Now, "PropAccessor - UpdateProp", e.StackTrace);
         return null;
     }
 }