public async Task <IHttpActionResult> Products(Guid userId) { var products = await _authProduct.AccountProductsGetAsync(userId); products.Sort(ProductComparer.Comparer); products.Reverse(); ProductComparer.ProductOrderer(products); return(Ok(products.ConvertAll(ProductConvertor.AccountProductConvertor))); }
public async Task <IHttpActionResult> Data(bool isIncludeModules = false) { try { var sessionProducts = await GetSessionTokenProducts(); if (object.Equals(sessionProducts.SessionToken, null)) { return(AccountUnauthorized()); } sessionProducts.Products.Sort(ProductComparer.Comparer); sessionProducts.Products.Reverse(); ProductComparer.ProductOrderer(sessionProducts.Products); var accountDetailsProducts = new AccountDetailsProducts { Details = await GetAccountDetails(), Products = sessionProducts.Products.ConvertAll(ProductConvertor.AccountProductConvertor) }; if (isIncludeModules && sessionProducts.SessionToken.AccountProductId.HasValue) { var product = sessionProducts.Products.FirstOrDefault(e => e.AccountProductId == sessionProducts.SessionToken.AccountProductId.Value && !e.IsDisabled); if (!object.Equals(product, null)) { var modules = UserManagerHelper.GetAllowedModules(sessionProducts.Products, product.AccountProductId); var active = UserManagerHelper.GetActiveProducts(sessionProducts.Products, modules, product.AccountProductId); var features = GetModuleFeatures(product, modules); accountDetailsProducts.Id = product.AccountProductId; accountDetailsProducts.Modules = modules; accountDetailsProducts.ModuleFeatures = features; accountDetailsProducts.ActiveProducts = active; } } return(Ok(accountDetailsProducts)); } catch (Exception exc) { return(Request.HttpExceptionResult(exc)); } }
public async Task <IHttpActionResult> Products() { try { var sessionProducts = await GetSessionTokenProducts(); if (object.Equals(sessionProducts.SessionToken, null)) { return(AccountUnauthorized()); } sessionProducts.Products.Sort(ProductComparer.Comparer); sessionProducts.Products.Reverse(); ProductComparer.ProductOrderer(sessionProducts.Products); return(Ok(sessionProducts.Products.ConvertAll(ProductConvertor.AccountProductConvertor))); } catch (Exception exc) { return(Request.HttpExceptionResult(exc)); } }