public JsonResult GetCategoryById()
        {
            int            id     = (int)HttpContext.Session.GetInt32("UpdateId");
            CategoryOutput output = _categoryManageService.GetCategory(id);

            HttpContext.Session.Remove("UpdateId");
            return(Json(output));
        }
Пример #2
0
 private CategoryResponse CategoryOutputToResponse(CategoryOutput output)
 {
     return(new CategoryResponse()
     {
         Category = output.Category,
         SubCategories = output.SubCategories.Select(sub => CategoryOutputToResponse(sub)).ToArray()
     });
 }
Пример #3
0
 internal static CategoryResponse CategoryOutputToResponse(this CategoryOutput output)
 {
     return(new CategoryResponse()
     {
         Category = output.Category,
         SubCategories = output.SubCategories.Select(sub => sub.CategoryOutputToResponse()).ToArray()
     });
 }
        public CategoryOutput GetCategory(int id)
        {
            Categorylnfo categorylnfo = _dbContext.Set <Categorylnfo>().Find(id);

            if (categorylnfo != null)
            {
                CategoryOutput output = new CategoryOutput
                {
                    CategoryId   = categorylnfo.CategoryId,
                    CategoryName = categorylnfo.CategoryName,
                    CurrentPrice = categorylnfo.CurrentPrice,
                    Unit         = categorylnfo.Unit,
                    AddTime      = categorylnfo.AddTime
                };
                return(output);
            }
            return(null);
        }