Ejemplo n.º 1
0
 public List <Common.Models.Category> GetCategories()
 {
     try
     {
         var dal          = new QuickKartRepository();
         var categoryList = dal.GetCategoriesUsingLinq();
         var categories   = new List <Common.Models.Category>();
         if (categoryList.Any())
         {
             foreach (var cat in categoryList)
             {
                 var category = new Common.Models.Category();
                 category.CategoryId   = cat.CategoryId;
                 category.CategoryName = cat.CategoryName;
                 categories.Add(category);
             }
         }
         return(categories);
     }
     catch (Exception ex)
     {
         return(null);
     }
 }