public async Task <bool> insertNegotiationplanrouteCF(GetNegotiationplanrouteCFDto getNegotiationplanrouteCFDto)
        {
            try
            {
                NegotiationplanrouteCF oNegotiationplanrouteCF = Mapper.Map <GetNegotiationplanrouteCFDto, NegotiationplanrouteCF>(getNegotiationplanrouteCFDto);

                if (getNegotiationplanrouteCFDto.isAccepted)
                {
                    if (await _NegotiationplanrouteCFs.AsNoTracking().AnyAsync(i => i.negotiationplanrouteId == getNegotiationplanrouteCFDto.negotiationplanrouteId && i.isAccepted == true))
                    {
                        return(true);
                    }
                }

                if (getNegotiationplanrouteCFDto.carrierId != 0)
                {
                    oNegotiationplanrouteCF.agentId = getNegotiationplanrouteCFDto.agentCarriers.Where(i => i.id == getNegotiationplanrouteCFDto.carrierId).Select(i => i.parentId).Single();
                }

                _NegotiationplanrouteCFs.Add(oNegotiationplanrouteCF);
                await _uow.SaveChangesAsync();

                return(true);
            }
            catch (Exception ex)
            {
                return(false);
            }
        }
        public async Task <bool> updateNegotiationplanrouteCF(GetNegotiationplanrouteCFDto getNegotiationplanrouteCFDto)
        {
            try
            {
                NegotiationplanrouteCF oNegotiationplanrouteCF = await _NegotiationplanrouteCFs.SingleAsync(i => i.id == getNegotiationplanrouteCFDto.id);

                if (!oNegotiationplanrouteCF.isAccepted && oNegotiationplanrouteCF.isAccepted)
                {
                    if (await _NegotiationplanrouteCFs.AnyAsync(i => i.negotiationplanrouteId == getNegotiationplanrouteCFDto.negotiationplanrouteId && i.isAccepted == true))
                    {
                        return(true);
                    }
                }

                if (getNegotiationplanrouteCFDto.carrierId != 0)
                {
                    oNegotiationplanrouteCF.agentId = getNegotiationplanrouteCFDto.agentCarriers.Where(i => i.id == getNegotiationplanrouteCFDto.carrierId).Select(i => i.parentId).Single();
                }

                oNegotiationplanrouteCF.carrierId     = getNegotiationplanrouteCFDto.carrierId;
                oNegotiationplanrouteCF.forwarderId   = getNegotiationplanrouteCFDto.forwarderId;
                oNegotiationplanrouteCF.netPrice      = getNegotiationplanrouteCFDto.netPrice;
                oNegotiationplanrouteCF.modiferUserId = getNegotiationplanrouteCFDto.userId;

                await _uow.SaveChangesAsync();

                return(true);
            }
            catch (Exception ex)
            {
                return(false);
            }
        }