コード例 #1
0
 public LogicResult <ProductCartModel> GetProductDetailForAddToCart(Guid productId)
 {
     try
     {
         var model = (from product in _productQueryService.GetAll()
                      join productType in _productTypeServiceFacade.Data on product.TypeId equals productType.Id
                      where product.Id == productId
                      select new ProductCartModel {
             Id = product.Id, Name = product.Name, Type = productType.Type, Point = productType.Point, UserId = CurrentUser.Id
         }).FirstOrDefault();
         var priceDetail = new PriceDetail
         {
             Type = model.Type.ToEnum <ProductType>()
         };
         var paymentDetailResult = _priceCalculationService.CalculatePrice(priceDetail);
         if (paymentDetailResult.IsSucceed)
         {
             model.PaymentDetail = paymentDetailResult.Data;
             return(LogicResult <ProductCartModel> .Succeed(model));
         }
         else
         {
             return(LogicResult <ProductCartModel> .Failure(Validation.UnSuccessfullOperation));
         }
     }
     catch
     {
         return(LogicResult <ProductCartModel> .Failure(Validation.UnSuccessfullOperation));
     }
 }