Beispiel #1
0
 public ProductResponse GetProduct(string productId)
 {
     try
     {
         using (ESamhashoEntities entities = new ESamhashoEntities())
         {
             if (long.TryParse(productId, out long id))
             {
                 ProductResponse productResponses = entities.GetProduct(id)
                                                    .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
                 })
                                                    .FirstOrDefault();
                 return(productResponses);
             }
             return(new ProductResponse());
         }
     }
     catch (Exception exception)
     {
         Dictionary <string, string> dictionary = new Dictionary <string, string>
         {
             { "productId", productId }
         };
         ServiceHelper.LogException(exception, dictionary, ErrorSource.Product);
         return(new ProductResponse());
     }
 }