public async Task <HttpResponseMessage> updatePackagetype(GetPackagetypeDto PackagetypeDto)
 {
     PackagetypeDto.userId = Setting.payloadDto.userId;
     if (await _PackagetypeService.updatePackagetype(PackagetypeDto))
     {
         return(new HttpResponseMessage(HttpStatusCode.OK));
     }
     else
     {
         return(new HttpResponseMessage(HttpStatusCode.NotModified));
     }
 }
 public async Task <HttpResponseMessage> insertPackagetype(GetPackagetypeDto PackagetypeDto)
 {
     PackagetypeDto.userId = Setting.payloadDto.userId;
     if (await _PackagetypeService.insertPackagetype(PackagetypeDto))
     {
         return(Request.CreateResponse(HttpStatusCode.Created));
     }
     else
     {
         return(new HttpResponseMessage(HttpStatusCode.InternalServerError));
     }
 }
        public async Task <GetPackagetypeDto> getPackagetype(int id)
        {
            GetPackagetypeDto oGetPackagetypeDto = await _PackagetypeService.getPackagetype(new BaseDto { id = id });

            if (oGetPackagetypeDto == null)
            {
                throw new HttpResponseException(new HttpResponseMessage(HttpStatusCode.NotFound));
            }
            else
            {
                return(oGetPackagetypeDto);
            }
        }
Exemple #4
0
        public async Task <bool> insertPackagetype(GetPackagetypeDto getPackagetypeDto)
        {
            try
            {
                Packagetype oPackagetype = Mapper.Map <GetPackagetypeDto, Packagetype>(getPackagetypeDto);
                _Packagetypes.Add(oPackagetype);
                await _uow.SaveChangesAsync();

                return(true);
            }
            catch
            {
                return(false);
            }
        }
Exemple #5
0
        public async Task <bool> updatePackagetype(GetPackagetypeDto getPackagetypeDto)
        {
            try
            {
                Packagetype oPackagetype = await _Packagetypes.SingleAsync(i => i.id == getPackagetypeDto.id);

                oPackagetype.packageName   = getPackagetypeDto.packageName;
                oPackagetype.packageCode   = getPackagetypeDto.packageCode;
                oPackagetype.packageDesc   = getPackagetypeDto.packageDesc;
                oPackagetype.isActive      = getPackagetypeDto.isActive;
                oPackagetype.modiferUserId = getPackagetypeDto.userId;

                await _uow.SaveChangesAsync();

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