Exemple #1
0
        public ActionResult <VideoRequestDetailsForTalentVM> Details(int id)
        {
            try
            {
                var          curUser = accountUtil.GetCurrentUser(User);
                VideoRequest request = VideoRequestService.GetActiveSingleDetailsWithRelatedDataByID(id);

                if (request == null || !VideoRequestService.BelongsToTalent(request, curUser.ID))
                {
                    throw new Exception("Ваш заказ не найден");
                }

                if (request.ViewedByTalent == false)
                {
                    request.ViewedByTalent = true;
                    VideoRequestService.Update(request, curUser.ID);
                }

                VideoRequestDetailsForTalentVM requestVM = new VideoRequestDetailsForTalentVM(request);

                //requestVM.accept_btn_is_available = VideoRequestService.IsAcceptable(request);
                requestVM.cancel_btn_is_available = VideoRequestService.IsCancelable(request);

                //requestVM.request_price = VideoRequestPriceCalculationsService.CalculateRequestPrice(request);
                //requestVM.RequestPriceToStr();

                //requestVM.remaining_price = VideoRequestPriceCalculationsService.CalculateRemainingPrice(request.Price, request.WebsiteCommission);
                //requestVM.RemainingPriceToStr();

                return(requestVM);
            }
            catch (Exception ex)
            {
                return(CustomBadRequest(ex));
            }
        }