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()); }
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()); }