public async Task <IActionResult> Insert([FromBody] PositionSingleDto entity) { try { int rows = await _service.Insert(entity);//得到影响行数 if (rows > 0) { return(CreateAction()); } return(OKAction(false, "创建失败!原因:影响行数为0")); } catch (Exception ex) { return(OKAction(false, $"创建失败!原因:{ex.Message}")); } }
public async Task <IActionResult> Update(string Id, [FromBody] PositionSingleDto entity) { try { entity.Id = Id; int rows = await _service.Update(entity);//得到影响行数 if (rows > 0) { return(OKAction(true, "更新成功")); } return(NotFoundAction(false, "更新失败!原因:影响行数为0")); } catch (Exception ex) { return(OKAction(false, $"更新失败!原因:{ex.Message}")); } }