Example #1
0
        static void Insert(IContactRepo repo)
        {
            var contact = new Contact
            {
                FirstName = "Viktor",
                LastName  = "Prykhidko",
                Email     = "*****@*****.**",
                Company   = "xyz",
                Title     = "Dev",
                Addresses = { new Address
                              {
                                  AddressType   = "Home",
                                  City          = "Kiev",
                                  ContactId     = 1,
                                  IsDeleted     = false,
                                  PostalCode    = "32057",
                                  StateId       = 1,
                                  StreetAddress = "Khreshchatyk"
                              } }
            };

            repo.Save(contact);

            Debug.Assert(contact.Id != 0);
            Console.WriteLine(contact.Id);
        }
Example #2
0
        static void GetAll(IContactRepo repo)
        {
            var contacts = repo.GetAll();

            Debug.Assert(contacts.Count > 0);
            Console.WriteLine(contacts.Serialize());
        }
Example #3
0
        public Contacts(ILogger <Contacts> logger, IMapper mapper, IContactRepo contactRepo)
        {
            logger.CheckNull();
            mapper.CheckNull();
            contactRepo.CheckNull();

            _logger      = logger;
            _mapper      = mapper;
            _contactRepo = contactRepo;
        }
Example #4
0
 public ContactService(IContactListRepo contactListRepo,
                       IContactRepo contactRepo,
                       IArloRegistrationSearchRepo registrationSearch,
                       ILogService logService,
                       IRedisEntityCache entityCache) : base(entityCache)
 {
     _contactListRepo    = contactListRepo;
     _contactRepo        = contactRepo;
     _registrationSearch = registrationSearch;
     _logService         = logService;
 }
        public ActionResult Contact(Contact contact)
        {
            if (ModelState.IsValid)
            {
                IContactRepo repo = Factory.GetContactRepo();
                repo.Insert(contact);

                return(RedirectToAction("Index"));
            }

            return(View(contact));
        }
Example #6
0
        static void Update(IContactRepo repo)
        {
            var c = repo.GetFullContact(1);

            c.FirstName = "Edited";
            c.Addresses[0].StreetAddress = "Edited";
            repo.Save(c);
            c = repo.GetFullContact(1);
            Debug.Assert(c.FirstName == "Edited");
            Debug.Assert(c.Addresses[0].StreetAddress == "Edited");
            Console.WriteLine(c.Serialize());
        }
Example #7
0
 public ContactsController(IContactRepo contactRepo, IMapper mapper,
                           IPropertyMappingService propertyMappingService,
                           IPropertyCheckerService propertyCheckerService)
 {
     _contactRepo = contactRepo ??
                    throw new ArgumentNullException(nameof(contactRepo));
     _mapper = mapper ??
               throw new ArgumentNullException(nameof(mapper));
     _propertyMappingService = propertyMappingService ??
                               throw new ArgumentNullException(nameof(propertyMappingService));
     _propertyCheckerService = propertyCheckerService ??
                               throw new ArgumentNullException(nameof(propertyCheckerService));
 }
Example #8
0
        static void Delete(IContactRepo repo)
        {
            var contact = new Contact
            {
                FirstName = "Viktor",
                LastName  = "Prykhidko",
                Email     = "*****@*****.**",
                Company   = "xyz",
                Title     = "Dev"
            };

            repo.Add(contact);
            var c = repo.Find(contact.Id);

            repo.Remove(c.Id);
            c = repo.Find(contact.Id);
            Debug.Assert(c == null);
            Console.WriteLine("Deleted");
        }
Example #9
0
        static void GetFullContact(IContactRepo repo)
        {
            var res = repo.GetFullContact(1);

            Console.WriteLine(res.Serialize());
        }
Example #10
0
 public ContactController(IContactRepo repo)
 {
     _repo = repo;
 }
Example #11
0
 public ViewModel()
 {
     repository = new ContactRepo();
     LoadDb();
     LoadCommands();
 }
Example #12
0
 //public ContactService()
 //{
 //    _contactRepo = new ContactRepo();
 //}
 public ContactService(IContactRepo contactRepo)
 {
     _contactRepo = contactRepo;
 }
Example #13
0
 public CompaniesController(ICompanyRepo companyRepo, IContactRepo contactRepo)
 {
     _companyRepo = companyRepo;
     _contactRepo = contactRepo;
 }
 public ContactManagementController(IContactRepo repo)
 {
     _repo = repo;
 }
Example #15
0
 public ApplicationsController(IApplicationRepo appRepo, IContactRepo contactRepo)
 {
     _appRepo     = appRepo;
     _contactRepo = contactRepo;
 }
Example #16
0
 public ActionResult <IEnumerable <Contact> > Get([FromServices] IContactRepo contactRepo)
 {
     return(contactRepo.GetContacts());
 }
Example #17
0
 public ContactController(IContactRepo _contactRepo)
 {
     this.contactRepo = _contactRepo;
 }
Example #18
0
 public ContactApiController(IContactRepo contactInfo)
 {
     _contactInfo = contactInfo;
 }
 public ContactController(IContactRepo contacts)
 {
     Contacts = contacts;
 }
Example #20
0
        static void FindById(IContactRepo repo)
        {
            var c = repo.GetFullContact(1);

            Console.WriteLine(c.Serialize());
        }
Example #21
0
 public ContactsController(IContactRepo contactRepo)
 {
     _contactRepo = contactRepo;
 }
Example #22
0
 public ContactsController(IContactRepo repo)
 {
     repository = repo;
 }
Example #23
0
 public AppService(IContactRepo contactRepo)
 {
     _iContactRepo = contactRepo;
 }