Ejemplo n.º 1
0
        public int AddContactInfo(PymeContactInfoInput input)
        {
            PymeContactInfo contactInfo;

            if (input.Id != 0)
            {
                contactInfo = _pymeManager.GetContactInfo(TenantId);
                var info = input.MapTo(contactInfo);
                return(_pymeManager.AddContactInfo(info));
            }
            contactInfo = input.MapTo <PymeContactInfo>();
            return(_pymeManager.AddContactInfo(contactInfo));
        }
Ejemplo n.º 2
0
        public object GetProperty(string property, PymePropertyListing info1)
        {
            try
            {
                switch (info1)
                {
                case PymePropertyListing.Info:
                    var info          = _pymeManager.GetInfo(TenantId);
                    var propertyValue = info.GetType().GetProperty(property).GetValue(info);
                    return(string.IsNullOrEmpty(propertyValue.ToString()) ? $"No se ha encontrado un valor para la propiedad {property} <a href='/Admin/MainMenu/'>Reparar</a>" : propertyValue);

                case PymePropertyListing.Contact:
                    var contactInfo = _pymeManager.GetContactInfo(TenantId);
                    var propertyContactInfoValue = contactInfo.GetType().GetProperty(property).GetValue(contactInfo);
                    return(propertyContactInfoValue);

                case PymePropertyListing.ContentSections:
                    var result = _pymeManager.GetMainPageContent(property, TenantId);
                    return(result);

                default:
                    throw new ArgumentOutOfRangeException(nameof(info1), info1, null);
                }
            }
            catch (Exception)
            {
                return($"No se ha encontrado la propiedad {property} <a href='/Admin/MainMenu/'>Reparar</a>");
            }
        }