Exemplo n.º 1
0
        private SimContact createSimContact(ClientContactModel clientContactModel)
        {
            SimContact simContact = new SimContact();

            simContact.name    = clientContactModel.name;
            simContact.surname = clientContactModel.surname;
            simContact.setMobileNumbers(this.createMobileNumbers(clientContactModel.mobileNumbers));
            _simContactRepo.Create(simContact);
            _simContactRepo.Save();
            return(simContact);
        }
Exemplo n.º 2
0
        public IEntity createContact(ClientContactModel clientContactModel)
        {
            switch (clientContactModel.contactType)
            {
            case ClientContactModel.contact:
                return(createPhoneContact(clientContactModel));

            default:
                return(createSimContact(clientContactModel));
            }
        }
        /// <summary>
        /// Add new client contact
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        public PartialViewResult AddArea(int id)
        {
            var data = GetBusinessAreaTypes().FirstOrDefault(x => x.Id == id);
            var clientContactData = new ClientContactModel()
            {
                BusinessAreaTypeId = id,
                BusinessAreaType   = data?.BusinessAreaType
            };

            return(PartialView("_ClientContactView", clientContactData));
        }
Exemplo n.º 4
0
 public IActionResult editContact([FromBody] ClientContactModel clientContactModel)
 {
     try
     {
         IEntity contact = _contactService.editContact(clientContactModel);
         return(Ok(contact));
     }
     catch (Exception ex)
     {
         return(StatusCode(500, ex));
     }
 }
Exemplo n.º 5
0
        private PhoneContact createPhoneContact(ClientContactModel clientContactModel)
        {
            PhoneContact phoneContact = new PhoneContact();

            phoneContact.name    = clientContactModel.name;
            phoneContact.surname = clientContactModel.surname;
            phoneContact.email   = clientContactModel.email;
            phoneContact.address = clientContactModel.address;
            _simContactRepo.Create(phoneContact);
            _simContactRepo.Save();
            phoneContact.setMobileNumbers(this.createMobileNumbers(clientContactModel.mobileNumbers));
            phoneContact.setContactTags(this.createContactTags(clientContactModel.contactTags, phoneContact));
            return(phoneContact);
        }
Exemplo n.º 6
0
        private PhoneContact updatePhoneContact(ClientContactModel clientContactModel)
        {
            PhoneContact dbContact = _simContactRepo.findPhoneContactByGuid(clientContactModel.guid);

            if (dbContact == null)
            {
                throw new Exception("Contact by guid: " + clientContactModel.guid + " is not found in db");
            }

            dbContact.name    = clientContactModel.name;
            dbContact.surname = clientContactModel.surname;
            dbContact.email   = clientContactModel.email;
            dbContact.address = clientContactModel.address;
            this.updateMobileNumbers(clientContactModel.mobileNumbers, dbContact);
            dbContact.setContactTags(this.updateContactTags(clientContactModel.contactTags, dbContact));
            return(dbContact);
        }
Exemplo n.º 7
0
        private SimContact updateSimContact(ClientContactModel clientContactModel)
        {
            if (clientContactModel.guid == null)
            {
                throw new Exception("Guid is not defined");
            }
            SimContact dbContact = _simContactRepo.findByGuid(clientContactModel.guid);

            if (dbContact == null)
            {
                throw new Exception("Contact by guid: " + clientContactModel.guid + " is not found in db");
            }
            dbContact.name    = clientContactModel.name;
            dbContact.surname = clientContactModel.surname;
            this.updateMobileNumbers(clientContactModel.mobileNumbers, dbContact);
            _simContactRepo.Save();
            return(dbContact);
        }