public LogicResult <ProductInvoiceModel> GetInvoiceForDownload(Guid productId, Guid userId) { try { var invoice = (from userToProduct in _userToProductQueryService.GetAll() join product in _productQueryService.GetAll() on userToProduct.ProductId equals product.Id join productType in _productTypeServiceFacade.Data on product.TypeId equals productType.Id where userToProduct.UserId == userId && userToProduct.ProductId == productId select new ProductInvoiceModel { Day = userToProduct.Day, UserId = userToProduct.UserId, Point = userToProduct.Point, Id = userToProduct.ProductId, PaymentDetail = SerializerHelper.DeserializeObject <PaymentDetail>(userToProduct.PaymentDetail), Name = product.Name, Type = productType.Type }).FirstOrDefault(); return(LogicResult <ProductInvoiceModel> .Succeed(invoice)); } catch { return(LogicResult <ProductInvoiceModel> .Failure(Validation.UnSuccessfullOperation)); } }
public virtual IEnumerable <UserToProductDTO> GetAll() { return(_userToProductQueryService.GetAll()); }