public int Update(ContactInfoViewModel contactInfoViewModel)
        {
            var contactInfo = EmContactInfo.SetToModel(contactInfoViewModel);

            _iContactInfoRepository.Update(contactInfo);
            return(Save());
        }
Beispiel #2
0
        public IActionResult UpdateContactInfo([FromBody] ContactInfo contactInfo)
        {
            var lang          = Request.Headers["language"].ToString();
            var errorMessages = new List <string>();

            try
            {
                var ci = _contactInfoRepository.GetContact();

                ci.Emails       = contactInfo.Emails;
                ci.Phone        = contactInfo.Phone;
                ci.LinkedInUrl  = contactInfo.LinkedInUrl;
                ci.GitHubUrl    = contactInfo.GitHubUrl;
                ci.FacebookUrl  = contactInfo.FacebookUrl;
                ci.Country_EN   = contactInfo.Country_EN;
                ci.Country_FR   = string.IsNullOrEmpty(contactInfo.Country_FR) ? contactInfo.Country_EN : contactInfo.Country_FR;
                ci.City_EN      = contactInfo.City_EN;
                ci.City_FR      = string.IsNullOrEmpty(contactInfo.City_FR) ? contactInfo.City_EN : contactInfo.City_FR;
                ci.Street       = contactInfo.Street;
                ci.StreetNumber = contactInfo.StreetNumber;
                ci.ZipCode      = contactInfo.ZipCode;


                var updatedContactInfo = _contactInfoRepository.Update(ci);

                return(Ok(new { updatedContactInfo }));
            }
            catch
            {
                errorMessages.Add(_translator.GetTranslation("ERROR", lang));
                return(BadRequest(new { errors = errorMessages }));
            }
        }
Beispiel #3
0
 public void UpdateContactInfo(ContactInfo contactInfo)
 {
     _iContactInfoRepository.Update(contactInfo);
     Save();
 }