예제 #1
0
        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));
        }
예제 #2
0
        public async Task <GetNegotiationplanrouteDto> getNegotiationplanrouteInitial(BaseDto baseDto)
        {
            GetNegotiationplanrouteDto oNegotiationplanrouteDto = new GetNegotiationplanrouteDto();

            oNegotiationplanrouteDto.negotiationplanId = baseDto.id;

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

            oNegotiationplanrouteDto.toLocations = await _LocationService.getLocationsDdlDto();

            oNegotiationplanrouteDto.transporttypes = await _TransporttypeService.getTransporttypesDdlDto();

            return(oNegotiationplanrouteDto);
        }
예제 #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));
     }
 }
예제 #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));
     }
 }
예제 #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);
            }
        }
예제 #7
0
        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);
            }
        }
예제 #8
0
        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);
            }
        }