Beispiel #1
0
 public List <ProductResponse> GetAllProducts()
 {
     try
     {
         using (ESamhashoEntities entities = new ESamhashoEntities())
         {
             List <ProductResponse> productResponses = entities.GetAllProducts().Select(a => new ProductResponse
             {
                 IsDeleted        = a.IsDeleted,
                 Description      = a.Description,
                 Code             = a.Code,
                 ModifiedDate     = a.ModifiedDate.ToLongDateString(),
                 Name             = a.Name,
                 Manufacturer     = a.Manufacturer,
                 UserId           = a.UserId,
                 MediaSource      = a.MediaSource,
                 ProductId        = a.ProductId,
                 Price            = a.Price,
                 Per              = a.Per,
                 ShortDescription = a.ShortDescription,
                 CreatedDate      = a.CreatedDate.ToLongDateString() + " " + a.CreatedDate.ToLongTimeString(),
                 CatergoryId      = a.CatergoryId,
                 Catergory        = a.Catergory,
                 IsMain           = a.IsMain,
                 IsActive         = a.IsActive
             }).ToList();
             return(productResponses);
         }
     }
     catch (Exception exception)
     {
         ServiceHelper.LogException(exception, new Dictionary <string, string>(), ErrorSource.Product);
         return(new List <ProductResponse>());
     }
 }