Пример #1
0
        public ActionResult AddContact(Contact contact)
        {
            if (contact != null) {
                using (var ctx = new ContactsContext()) {
                    ctx.Contacts.Add(contact);
                    ctx.SaveChanges();
                }
            }

            return RedirectToAction("Index");
        }
Пример #2
0
        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);
        }
Пример #3
0
 public ContactRepository(ContactsContext context)
 {
     _context = context;
 }
Пример #4
0
        public static List <ContactModel> GetContactsDb(int idUser)
        {
            var db = new ContactsContext();

            return(db.ContactDbset.Where(x => x.IdUser == idUser).OrderBy(i => i.FullName).ToList());
        }
Пример #5
0
 public CompanyService(ContactsContext contactsContext)
 {
     _contactsContext = contactsContext;
 }
 public ValuesController(ContactsContext context)
 {
     _context = context;
 }
Пример #7
0
 public SportsController(ContactsContext context)
 {
     _context = context;
 }
Пример #8
0
 public PeopleController(ContactsContext context)
 {
     _context = context;
 }
Пример #9
0
 public ContactController(ContactsContext context)
 {
     contactsContext = context;
 }
Пример #10
0
 public PeopleController(ContactsContext context, IMapper mapper)
 {
     _context = context;
     _mapper  = mapper;
 }
 public SeedDataController(ContactsContext context)
 {
     _context = context;
 }
Пример #12
0
        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();
        }
Пример #13
0
 public HomeController(ContactsContext ctx)
 {
     context = ctx;
 }
Пример #14
0
 public ContactRep()
 {
     context = new ContactsContext();
 }
Пример #15
0
 public HomeController(ContactsContext context)
 {
     _context = context;
 }
Пример #16
0
 public ConcessionariasController(ContactsContext context)
 {
     _context = context;
 }
Пример #17
0
 public ContactsController(ContactsContext db)
 {
     uow = new UnitOfWork(db);
 }
Пример #18
0
 public TeamsController(ContactsContext context)
 {
     _context = context;
 }
Пример #19
0
 public EmailsController(ContactsContext context)
 {
     _context = context;
 }
Пример #20
0
 public HomeController()
 {
     _db = new ContactsContext();
 }
Пример #21
0
 public SqliteRepository()
 {
     this.db = new ContactsContext();
     db.Contacts.Load();
 }
Пример #22
0
 public UnitOfWork(ContactsContext context)
 {
     db = context;
 }
Пример #23
0
 public SIFArenasController(ContactsContext context)
 {
     _context = context;
 }
 public ContactHandler(ContactsContext db) => this.db = db;
Пример #25
0
 static DatabaseManager()
 {
     _entities = new ContactsContext();
 }
Пример #26
0
 public ContactsAPI(ContactsContext context)
 {
     _context = context;
 }
Пример #27
0
        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);
        }
Пример #28
0
 public CsvController(ContactsContext context, IMemoryCache memoryCache)
 {
     _context = context;
     _cache   = memoryCache;
 }
Пример #29
0
 public ApiController(ContactsContext context)
 {
     db = context;
 }
Пример #30
0
 public void Save(ContactsContext context)
 {
     SaveContext(context);
 }
Пример #31
0
 public Contacts1Controller(ContactsContext context)
 {
     _context = context;
 }
Пример #32
0
 public AddressesController(ContactsContext context)
 {
     _context = context;
 }