public IActionResult Put(int id, [FromBody] FlowModification flow) { if (flow == null) { return(BadRequest()); } if (ModelState.IsValid == false) { return(BadRequest(ModelState)); } if (!_flowRepository.FlowExist(id)) { return(StatusCode(500, "不存在")); } var result = _flowRepository.GetFlow(id); if (result == null) { return(NotFound()); } Mapper.Map(flow, result); if (!_flowRepository.save()) { return(StatusCode(500, "保存产品的时候出错")); } return(NoContent()); }
public IActionResult Get(int id, int mid) { if (!_flowRepository.FlowExist(id)) { return(NotFound()); } var result = _flowRepository.GetMaterialForFlow(id, mid); if (result == null) { return(NotFound()); } //var m = result.Materials.SingleOrDefault(x => x.Id == mid); //if (m == null) //{ // return NotFound(); //} var re = new Material { Id = result.Id, Name = result.Name }; return(Ok(new JsonResult(re))); }