Ejemplo n.º 1
0
        public IActionResult GetContactInfo()
        {
            var lang          = Request.Headers["language"].ToString();
            var errorMessages = new List <string>();

            try
            {
                var contactInfo = _contactInfoRepository.GetContact();
                if (contactInfo == null)
                {
                    var newCI = new ContactInfo
                    {
                        Emails       = "",
                        Phone        = "",
                        LinkedInUrl  = "",
                        GitHubUrl    = "",
                        FacebookUrl  = "",
                        Country_EN   = "",
                        Country_FR   = "",
                        City_EN      = "",
                        City_FR      = "",
                        ZipCode      = "",
                        Street       = "",
                        StreetNumber = ""
                    };
                    contactInfo = _contactInfoRepository.Create(newCI);
                }

                return(Ok(new { contactInfo }));
            }
            catch
            {
                errorMessages.Add(_translator.GetTranslation("ERROR", lang));
                return(BadRequest(new { errors = errorMessages }));
            }
        }