public JObject OfflineGood(OnlineGoodDto dto) { JObject jo = new JObject(); var length = dto.IdList.Count; for (var i = 0; i < length; i++) { long temp = dto.IdList[i]; var result = WebapiDbContext.Goods.Where(o => o.Id == temp).FirstOrDefault(); if (result != null && result.Is_deleted == "否" && result.State == "已上架") { result.State = "已下架"; WebapiDbContext.SaveChanges(); } } jo["stateCode"] = 200; jo["message"] = "success!"; return(jo); }
public IActionResult OfflineGood([FromServices] IWebapiService webapiService, [FromBody] OnlineGoodDto dto) { return(Json(webapiService.OfflineGood(dto))); }