public static void SaveMain(string name, string description) { Models.Main main = new Models.Main() { Name = name, Description = description }; mainAdapter.Insert <Models.Main>(main); }
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(); } }