public async Task <GetNegotiationplanrouteDto> getNegotiationplanroute(BaseDto baseDto)
        {
            GetNegotiationplanrouteDto oNegotiationplanrouteDto = Mapper.Map <Negotiationplanroute, GetNegotiationplanrouteDto>(
                await _Negotiationplanroutes.AsNoTracking().SingleOrDefaultAsync(i => i.id == baseDto.id));

            return(await fillDdl(oNegotiationplanrouteDto));
        }
        public async Task <GetNegotiationplanrouteDto> getNegotiationplanrouteInitial(BaseDto baseDto)
        {
            GetNegotiationplanrouteDto oNegotiationplanrouteDto = new GetNegotiationplanrouteDto();

            oNegotiationplanrouteDto.negotiationplanId = baseDto.id;

            return(await  fillDdl(oNegotiationplanrouteDto));
        }
        private async Task <GetNegotiationplanrouteDto> fillDdl(GetNegotiationplanrouteDto oNegotiationplanrouteDto)
        {
            oNegotiationplanrouteDto.fromLocations = await _LocationService.getLocationsDdlDto();

            oNegotiationplanrouteDto.toLocations = await _LocationService.getLocationsDdlDto();

            oNegotiationplanrouteDto.transporttypes = await _TransporttypeService.getTransporttypesDdlDto();

            return(oNegotiationplanrouteDto);
        }
Beispiel #4
0
 public async Task <HttpResponseMessage> updateNegotiationplanroute(GetNegotiationplanrouteDto NegotiationplanrouteDto)
 {
     NegotiationplanrouteDto.userId = Setting.payloadDto.userId;
     if (await _NegotiationplanrouteService.updateNegotiationplanroute(NegotiationplanrouteDto))
     {
         return(new HttpResponseMessage(HttpStatusCode.OK));
     }
     else
     {
         return(new HttpResponseMessage(HttpStatusCode.NotModified));
     }
 }
Beispiel #5
0
 public async Task <HttpResponseMessage> insertNegotiationplanroute(GetNegotiationplanrouteDto NegotiationplanrouteDto)
 {
     NegotiationplanrouteDto.userId = Setting.payloadDto.userId;
     if (await _NegotiationplanrouteService.insertNegotiationplanroute(NegotiationplanrouteDto))
     {
         return(Request.CreateResponse(HttpStatusCode.Created));
     }
     else
     {
         return(new HttpResponseMessage(HttpStatusCode.InternalServerError));
     }
 }
Beispiel #6
0
        public async Task <GetNegotiationplanrouteDto> getNegotiationplanroute(int id)
        {
            GetNegotiationplanrouteDto oGetNegotiationplanrouteDto = await _NegotiationplanrouteService.getNegotiationplanroute(new BaseDto { id = id });

            if (oGetNegotiationplanrouteDto == null)
            {
                throw new HttpResponseException(new HttpResponseMessage(HttpStatusCode.NotFound));
            }
            else
            {
                return(oGetNegotiationplanrouteDto);
            }
        }
        public async Task <bool> insertNegotiationplanroute(GetNegotiationplanrouteDto getNegotiationplanrouteDto)
        {
            try
            {
                Negotiationplanroute oNegotiationplanroute = Mapper.Map <GetNegotiationplanrouteDto, Negotiationplanroute>(getNegotiationplanrouteDto);
                _Negotiationplanroutes.Add(oNegotiationplanroute);
                await _uow.SaveChangesAsync();

                return(true);
            }
            catch (Exception ex)
            {
                return(false);
            }
        }
        public async Task <bool> updateNegotiationplanroute(GetNegotiationplanrouteDto getNegotiationplanrouteDto)
        {
            try
            {
                Negotiationplanroute oNegotiationplanroute = await _Negotiationplanroutes.SingleAsync(i => i.id == getNegotiationplanrouteDto.id);

                oNegotiationplanroute.fromLocationId  = getNegotiationplanrouteDto.fromLocationId;
                oNegotiationplanroute.toLocationId    = getNegotiationplanrouteDto.toLocationId;
                oNegotiationplanroute.transporttypeId = getNegotiationplanrouteDto.transporttypeId;
                oNegotiationplanroute.modiferUserId   = getNegotiationplanrouteDto.userId;

                await _uow.SaveChangesAsync();

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