示例#1
0
        public async Task <IActionResult> UpdateContactAgency([FromBody] DTOs.ContactAgencyForUpdate contactAgencyForUpdate)
        {
            log.Info("UpdateContactAgency");
            if (contactAgencyForUpdate == null)
            {
                return(BadRequest());
            }

            var ContactAgencyFromRepo = await _contactAgencyRepository.GetContactAgencyIdByIdAsync(contactAgencyForUpdate.ContactAgencyId);

            if (ContactAgencyFromRepo == null)
            {
                return(BadRequest());
            }

            contactAgencyForUpdate.UserId = "Manoj";

            /* work on getting the update done */
            Entities.ArmsContactAgency contactAgencytoUpdate = _mapper.Map(contactAgencyForUpdate, ContactAgencyFromRepo);

            /* Update the contact Agency information for the contact */
            _contactAgencyRepository.UpdateContactAgency(contactAgencytoUpdate);

            var ContactAgency = _mapper.Map <DTOs.ContactAgencyForDD>(contactAgencyForUpdate);

            ContactAgency.AgencyName = GetAgencyName(ContactAgency.AgencyID);

            return(Ok(ContactAgency));
        }
示例#2
0
        public async Task <IActionResult> AddNewContactAgency([FromBody] DTOs.ContactAgencyForCreate contactAgencyForCreate)
        {
            log.Info("Create ContactAgency");
            if (contactAgencyForCreate == null)
            {
                return(BadRequest());
            }
            contactAgencyForCreate.UserId = "Manoj";

            /* work on getting the insert done */
            Entities.ArmsContactAgency contactAgencytoCreate = _mapper.Map <Entities.ArmsContactAgency>(contactAgencyForCreate);

            /* insert the contact Agency information for the contact */
            await _contactAgencyRepository.AddContactAgencyAsync(contactAgencytoCreate);

            var ContactAgency = _mapper.Map <DTOs.ContactAgencyForDD>(contactAgencyForCreate);

            ContactAgency.AgencyName = GetAgencyName(ContactAgency.AgencyID);

            return(Ok(contactAgencyForCreate));
        }