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 <GetNegotiationplanrouteCFDto> getNegotiationplanrouteCF(BaseDto baseDto) { GetNegotiationplanrouteCFDto oNegotiationplanrouteCFDto = Mapper.Map <NegotiationplanrouteCF, GetNegotiationplanrouteCFDto>( await _NegotiationplanrouteCFs.AsNoTracking().SingleOrDefaultAsync(i => i.id == baseDto.id)); return(await fillDdl(oNegotiationplanrouteCFDto)); }
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); } }
public async Task <GetNegotiationplanrouteCFDto> getNegotiationplanrouteCFInitial(BaseDto baseDto) { GetNegotiationplanrouteCFDto oNegotiationplanrouteCFDto = new GetNegotiationplanrouteCFDto(); oNegotiationplanrouteCFDto.negotiationplanrouteId = baseDto.id; return(await fillDdl(oNegotiationplanrouteCFDto)); }
private async Task <GetNegotiationplanrouteCFDto> fillDdl(GetNegotiationplanrouteCFDto oNegotiationplanrouteCFDto) { int locationId = await _NegotiationplanrouteService.getFromLocationId(oNegotiationplanrouteCFDto.negotiationplanrouteId); // oNegotiationplanrouteCFDto.forwarders = await _ForwarderService.getForwardersDdlDto(); oNegotiationplanrouteCFDto.agentCarriers = await _AgentCarrierService.getAgentCarriersDdlDto(locationId); return(oNegotiationplanrouteCFDto); }
public async Task <HttpResponseMessage> updateNegotiationplanrouteCF(GetNegotiationplanrouteCFDto NegotiationplanrouteCFDto) { NegotiationplanrouteCFDto.userId = Setting.payloadDto.userId; if (await _NegotiationplanrouteCFService.updateNegotiationplanrouteCF(NegotiationplanrouteCFDto)) { return(new HttpResponseMessage(HttpStatusCode.OK)); } else { return(new HttpResponseMessage(HttpStatusCode.NotModified)); } }
public async Task <HttpResponseMessage> insertNegotiationplanrouteCF(GetNegotiationplanrouteCFDto NegotiationplanrouteCFDto) { NegotiationplanrouteCFDto.userId = Setting.payloadDto.userId; if (await _NegotiationplanrouteCFService.insertNegotiationplanrouteCF(NegotiationplanrouteCFDto)) { return(Request.CreateResponse(HttpStatusCode.Created)); } else { return(new HttpResponseMessage(HttpStatusCode.InternalServerError)); } }
public async Task <GetNegotiationplanrouteCFDto> getNegotiationplanrouteCF(int id) { GetNegotiationplanrouteCFDto oGetNegotiationplanrouteCFDto = await _NegotiationplanrouteCFService.getNegotiationplanrouteCF(new BaseDto { id = id }); if (oGetNegotiationplanrouteCFDto == null) { throw new HttpResponseException(new HttpResponseMessage(HttpStatusCode.NotFound)); } else { return(oGetNegotiationplanrouteCFDto); } }