public IList <AttributeCultureExtended> ListAttributeCulture(int?idAttribute) { List <AttributeCultureExtended> result = new List <AttributeCultureExtended>(); foreach (var item in ServiceContext.CultureService.GetAllActive()) { var attributeCultureExtended = new AttributeCultureExtended() { IDCulture = item.IDCulture, IconPath = item.IconPath, CultureName = item.Name }; if (idAttribute.HasValue) { attributeCultureExtended.IDAttribute = idAttribute.Value; var culture = ServiceContext.AttributeCultureService.GetById(idAttribute.Value, item.IDCulture); if (culture != null) { attributeCultureExtended.Value = culture.Value; attributeCultureExtended.Name = culture.Name; } } result.Add(attributeCultureExtended); } return(result); }
// // GET: /Purpose/ public ActionResult Create(int index, int?idAttribute, string idCulture) { this.ViewBag.Index = index; if (idAttribute.HasValue) { var attrCulture = ServiceContext.AttributeCultureService.GetById(idAttribute.Value, idCulture); if (attrCulture == null) { var culture = ServiceContext.CultureService.GetById(idCulture); attrCulture = new AttributeCultureExtended() { IDAttribute = idAttribute.Value, IDCulture = idCulture, CultureName = culture.Name, IconPath = culture.IconPath }; } return(View(attrCulture)); } else { var culture = ServiceContext.CultureService.GetById(idCulture); return(View(new AttributeCultureExtended() { IDCulture = idCulture, CultureName = culture.Name, IconPath = culture.IconPath })); } }