예제 #1
0
        } // Index

        // Получение детальной информации об элементе
        public async Task <IActionResult> Details(int id, bool ajaxLoad, string connectionId, string previousUrl)
        {
            try
            {
                var proposal = await _proposalRepository.GetProposal(id);

                if (proposal == null)
                {
                    throw new Exception();
                }

                var viewModel = new DetailsViewModel(
                    proposal,
                    await _proposalImageRepository.GetProposalImagesPath(id),
                    await _requisitionRepository.GetRequisitions(proposal.Machine));

                if (!ajaxLoad)
                {
                    return(View(viewModel));
                }
                return(PartialView(viewModel));
            }
            catch { _message = Messages.downloadErrorMessage; } // try-catch

            await _hub.Clients.Client(connectionId).SendAsync("Error", _message);

            if (previousUrl == null)
            {
                return(RedirectToAction("Index", new { ajaxLoad = true }));
            }
            return(Redirect(previousUrl + "?ajaxLoad=true"));
        } // Details
예제 #2
0
        public async Task <ProposalGetRes> GetProposal([FromBody] ProposalGetReq request)
        {
            var response = new ProposalGetRes();

            try
            {
                if (!string.IsNullOrEmpty(request.QRFID) && request != null)
                {
                    //response = await _itineraryRepository.GetItinerary(request);
                    //response.ResponseStatus.Status = "Success";

                    ProposalGetRes result = _proposalRepository.GetProposal(request);

                    response.ResponseStatus.Status       = "Success";
                    response.ResponseStatus.ErrorMessage = result != null ? "" : "No Records Found.";

                    response = result;
                }
                else
                {
                    response.ResponseStatus.Status       = "Failure";
                    response.ResponseStatus.ErrorMessage = "QRFId can not be Null/Zero.";
                }
            }
            catch (Exception ex)
            {
                response.ResponseStatus.Status       = "Failure";
                response.ResponseStatus.ErrorMessage = "An Error Occurs :- " + ex.Message;
            }

            return(response);
        }
예제 #3
0
        public async Task <ProposalDTO> GetProposal(string idProposal)
        {
            try
            {
                var proposal = await _proposalRepository.GetProposal(idProposal);

                return(proposal);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
예제 #4
0
        public Proposal GetProposal(Guid id)
        {
            var proposal = _proposalRepository.GetProposal(id);

            return(proposal);
        }