コード例 #1
0
        public async Task <IHttpActionResult> GetById(int id)
        {
            ProductAttributeValueDTO ProductAttributeValue = await ProductAttributeValueService.GetAll().Where(x => x.Id == id && !x.Deleted).ProjectTo <ProductAttributeValueDTO>().FirstOrDefaultAsync();

            if (ProductAttributeValue == null)
            {
                return(NotFound());
            }
            return(Ok(ProductAttributeValue));
        }
コード例 #2
0
        public async Task <IHttpActionResult> Create([FromBody] ProductAttributeValueDTO ProductAttributeValueDto)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            var entity = ProductAttributeValueDto.ToEntity();

            entity.CreateUserId = User.Identity.GetUserId();
            entity.CreateTime   = DateTime.Now;
            await ProductAttributeValueService.InsertAsync(entity);

            return(Ok(entity.ToModel()));
        }
コード例 #3
0
ファイル: MappingExtensions.cs プロジェクト: dotaeye/mb360
 public static ProductAttributeValue ToEntity(this ProductAttributeValueDTO dto, ProductAttributeValue entity)
 {
     return(Mapper.Map(dto, entity));
 }
コード例 #4
0
ファイル: MappingExtensions.cs プロジェクト: dotaeye/mb360
 public static ProductAttributeValue ToEntity(this ProductAttributeValueDTO dto)
 {
     return(Mapper.Map <ProductAttributeValueDTO, ProductAttributeValue>(dto));
 }