Exemplo n.º 1
0
        public async Task <IHttpActionResult> Delete([FromBody] ProductCarCateModel model)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }
            var entities = ProductCarCateService.GetAll().Where(x => model.Ids.Contains(x.Id)).ToList();

            await ProductCarCateService.DeleteAsync(entities);

            return(Ok());
        }
Exemplo n.º 2
0
        public async Task <IHttpActionResult> Create([FromBody] ProductCarCateModel model)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }
            var entities = model.Ids.Select(x => new ProductCarCate()
            {
                ProductId = model.ProductId,
                CarCateId = x
            }).ToList();

            await ProductCarCateService.InsertAsync(entities);

            return(Ok());
        }