Example #1
0
 public static void InsertArea(Area area)
 {
     using (BDMSEntities dbContext = new BDMSEntities())
     {
         try
         {
             dbContext.Areas.Add(area);
             dbContext.SaveChanges();
         }
         catch (Exception ex)
         {
             throw;
         }
         finally { dbContext.Dispose(); }
     }
 }
Example #2
0
 public static void UpdateArea(Area updatedArea)
 {
     using (BDMSEntities dbContext = new BDMSEntities())
     {
         try
         {
             Area area = dbContext.Areas.FirstOrDefault(x => x.AreaId.Equals(updatedArea.AreaId));
             if (area != null)
             {
                 area = updatedArea;
                 dbContext.SaveChanges();
             }
         }
         catch (Exception ex)
         {
             throw;
         }
         finally { dbContext.Dispose(); }
     }
 }