Пример #1
0
 public static void SaveMain(string name, string description)
 {
     Models.Main main = new Models.Main()
     {
         Name        = name,
         Description = description
     };
     mainAdapter.Insert <Models.Main>(main);
 }
Пример #2
0
        public static void UpdateMain(int id, string name, string description)
        {
            using (AdapterDesingPatternContext adapterDesingPatternContext = new AdapterDesingPatternContext())
            {
                Models.Main main = adapterDesingPatternContext.Mains.SingleOrDefault(a => a.Id == id);

                main.Name        = name;
                main.Description = description;

                adapterDesingPatternContext.Mains.Update(main);
                adapterDesingPatternContext.SaveChanges();
            }
        }