public ActionResult AddContact(Contact contact) { if (contact != null) { using (var ctx = new ContactsContext()) { ctx.Contacts.Add(contact); ctx.SaveChanges(); } } return RedirectToAction("Index"); }
public ActionResult Index() { List<Contact> contacts = null; using (var ctx = new ContactsContext()) { contacts = (from c in ctx.Contacts select c).ToList(); } if (contacts == null) { contacts = new List<Contact>(); } return View(contacts); }
public ContactRepository(ContactsContext context) { _context = context; }
public static List <ContactModel> GetContactsDb(int idUser) { var db = new ContactsContext(); return(db.ContactDbset.Where(x => x.IdUser == idUser).OrderBy(i => i.FullName).ToList()); }
public CompanyService(ContactsContext contactsContext) { _contactsContext = contactsContext; }
public ValuesController(ContactsContext context) { _context = context; }
public SportsController(ContactsContext context) { _context = context; }
public PeopleController(ContactsContext context) { _context = context; }
public ContactController(ContactsContext context) { contactsContext = context; }
public PeopleController(ContactsContext context, IMapper mapper) { _context = context; _mapper = mapper; }
public SeedDataController(ContactsContext context) { _context = context; }
public ContactsVM() { _DB = new ContactsContext(); soapClient = new SoapService.SoapServiceClient(); Contacts = new ObservableCollection <Contact>(); Addresses = new ObservableCollection <Address>(); Companies = new ObservableCollection <Company>(); AddressIDs = new ObservableCollection <int>(); /* Old save command * SaveCommand = new DelegateCommand(() => { * _DB.SaveChanges(); * }); */ SaveCommand = new DelegateCommand(() => { foreach (var x in Contacts) { soapClient.AddContact(x); } soapClient.Save(); }); /*old Add Contact * AddContactCommand = new DelegateCommand(() => { * ViewingContact = new Contact(); * Contacts.Add(ViewingContact); * _DB.Contacts.Add(VewingContact); * }); */ AddContactCommand = new DelegateCommand(() => { ViewingContact = new Contact(); Contacts.Add(ViewingContact); //soapClient.AddContactAsync(ViewingContact); }); AddCompanyCommand = new DelegateCommand(() => { ViewingCompany = new Company(); Companies.Add(ViewingCompany); _DB.Companies.Add(ViewingCompany); }); AddAddressCommand = new DelegateCommand(() => { ViewingAddress = new Address(); Addresses.Add(ViewingAddress); _DB.Addresses.Add(ViewingAddress); }); DeleteContactCommand = new DelegateCommand(() => { _DB.Contacts.Remove(ViewingContact); Contacts.Remove(ViewingContact); }); DeleteCompanyCommand = new DelegateCommand(() => { _DB.Contacts.Remove(ViewingContact); Contacts.Remove(ViewingContact); }); DeleteAddressCommand = new DelegateCommand(() => { _DB.Contacts.Remove(ViewingContact); Contacts.Remove(ViewingContact); }); AddContactMethodCommand = new DelegateCommand(() => { var cm = new ContactMethod(); ViewingContact.ContactMethods.Add(cm); }); init(); }
public HomeController(ContactsContext ctx) { context = ctx; }
public ContactRep() { context = new ContactsContext(); }
public HomeController(ContactsContext context) { _context = context; }
public ConcessionariasController(ContactsContext context) { _context = context; }
public ContactsController(ContactsContext db) { uow = new UnitOfWork(db); }
public TeamsController(ContactsContext context) { _context = context; }
public EmailsController(ContactsContext context) { _context = context; }
public HomeController() { _db = new ContactsContext(); }
public SqliteRepository() { this.db = new ContactsContext(); db.Contacts.Load(); }
public UnitOfWork(ContactsContext context) { db = context; }
public SIFArenasController(ContactsContext context) { _context = context; }
public ContactHandler(ContactsContext db) => this.db = db;
static DatabaseManager() { _entities = new ContactsContext(); }
public ContactsAPI(ContactsContext context) { _context = context; }
public void Seed() { ContactsContext context = new ContactsContext(); if (context.Profiles.Any()) { Assert.IsTrue(true); return; } var profiles = new List <Profile> { new Profile { LastName = "Николаев", FirstName = "Александр", MiddleName = "Гаврилович", BirthDate = new DateTime(1995, 8, 26), Organization = "Николаев и КО", JobTitle = "Руководитель" }, new Profile { LastName = "Быков", FirstName = "Максим", MiddleName = "Иванович", BirthDate = new DateTime(1989, 11, 1), Organization = "ГазНефть", JobTitle = "Инженер" }, new Profile { LastName = "Никифоров", FirstName = "Артём", MiddleName = "", BirthDate = new DateTime(1990, 5, 12), Organization = "МеталКопал", JobTitle = "Водитель" }, new Profile { LastName = "Фролов", FirstName = "Михаил", MiddleName = "Владимирович", BirthDate = new DateTime(1993, 9, 5), Organization = "Електромонтаж", JobTitle = "Электромонтажник" }, new Profile { LastName = "Волков", FirstName = "Иван", MiddleName = "", BirthDate = new DateTime(1990, 10, 12), Organization = "", JobTitle = "Адвокат" }, new Profile { LastName = "Рябов", FirstName = "Дмитрий", MiddleName = "Михайлович", BirthDate = new DateTime(2001, 8, 21), Organization = "", JobTitle = "Продавец" }, new Profile { LastName = "Маслов", FirstName = "Кирилл", MiddleName = "Анатольевич", BirthDate = new DateTime(1985, 10, 23), Organization = "ООО Тудей Банк", JobTitle = "" } }; profiles.ForEach(prof => context.Profiles.Add(prof)); context.SaveChanges(); var contactData = new List <Contact> { new Contact { ProfileID = 1, ContactTypeID = 100, Value = "+7 747-528-5957" }, new Contact { ProfileID = 1, ContactTypeID = 200, Value = "*****@*****.**" }, new Contact { ProfileID = 1, ContactTypeID = 300, Value = "4909842975" }, new Contact { ProfileID = 2, ContactTypeID = 200, Value = "*****@*****.**" }, new Contact { ProfileID = 2, ContactTypeID = 300, Value = "*****@*****.**" }, new Contact { ProfileID = 3, ContactTypeID = 100, Value = "+7 769-602-2202" }, new Contact { ProfileID = 4, ContactTypeID = 100, Value = "+7 826-323-2544" }, new Contact { ProfileID = 5, ContactTypeID = 100, Value = "+7 598-357-1363" }, new Contact { ProfileID = 5, ContactTypeID = 200, Value = "*****@*****.**" }, new Contact { ProfileID = 5, ContactTypeID = 1000, Value = "www.advokaty.ru" }, new Contact { ProfileID = 6, ContactTypeID = 100, Value = "+7 140-428-5967" }, new Contact { ProfileID = 7, ContactTypeID = 100, Value = "+7 638-823-1405" }, new Contact { ProfileID = 7, ContactTypeID = 100, Value = "+7 906-351-7560" } }; contactData.ForEach(cont => context.Contacts.Add(cont)); context.SaveChanges(); Assert.IsTrue(true); }
public CsvController(ContactsContext context, IMemoryCache memoryCache) { _context = context; _cache = memoryCache; }
public ApiController(ContactsContext context) { db = context; }
public void Save(ContactsContext context) { SaveContext(context); }
public Contacts1Controller(ContactsContext context) { _context = context; }
public AddressesController(ContactsContext context) { _context = context; }