Esempio n. 1
0
 /// <summary>
 /// Creates a new connection record
 /// </summary>
 /// <param name="Connection"></param>
 /// <returns></returns>
 public static Connection CreateConnection(Connection Connection)
 {
     using (DatabaseContext db = new DatabaseContext())
     {
         db.Connections.Add(Connection);
         db.Entry(Connection).State = System.Data.Entity.EntityState.Added;
         db.SaveChanges();
         return Connection;
     }
 }
Esempio n. 2
0
 /// <summary>
 /// Creates a new solution record and returns the updated object
 /// </summary>
 /// <param name="solution"></param>
 /// <returns></returns>
 public static Solution CreateSolution(Solution solution)
 {
     using (DatabaseContext db = new DatabaseContext())
     {
         db.Solutions.Add(solution);
         db.Entry(solution).State = System.Data.Entity.EntityState.Added;
         db.SaveChanges();
         return solution;
     }
 }
Esempio n. 3
0
 /// <summary>
 /// Updates a solution record
 /// </summary>
 /// <param name="solution"></param>
 /// <returns></returns>
 public static void UpdateSolution(Solution solution)
 {
     using (DatabaseContext db = new DatabaseContext())
     {
         db.Solutions.Add(solution);
         db.Entry(solution).State = System.Data.Entity.EntityState.Modified;
         db.SaveChanges();
     }
 }
Esempio n. 4
0
 /// <summary>
 /// Saves the settings
 /// </summary>
 /// <param name="settings"></param>
 public static void SaveSettings(Settings settings)
 {
     using (DatabaseContext db = new DatabaseContext())
     {
         db.Settings.Add(settings);
         db.Entry(settings).State = System.Data.Entity.EntityState.Modified;
         db.SaveChanges();
     }
 }
Esempio n. 5
0
        /// <summary>
        /// Deletes a solution
        /// </summary>
        /// <param name="solution"></param>
        public static void DeleteSolution(Solution solution)
        {
            using (DatabaseContext db = new DatabaseContext())
            {
                db.Entry(solution).State = System.Data.Entity.EntityState.Deleted;
                db.Solutions.Remove(solution);
                db.SaveChanges();

            }
        }
Esempio n. 6
0
 /// <summary>
 /// Deletes a connection
 /// </summary>
 /// <param name="Connection"></param>
 public static void DeleteConnection(Connection Connection)
 {
     using (DatabaseContext db = new DatabaseContext())
     {
         db.Entry(Connection).State = System.Data.Entity.EntityState.Deleted;
         db.SaveChanges();
     }
 }