public async Task <ApiResult <string> > Update(int id, [FromBody] BlogArticleEditWebModel model) { var r = new ApiResult <string>(); if (!id.Equals(model.Id)) { r.status = 400; r.msg = "传入Id与实体Id不一致"; return(r); } var isExist = await _blogArticleServices.IsExist(id); if (!isExist) { r.status = 404; r.msg = "未匹配到数据"; return(r); } try { r.status = await _blogArticleServices.UpdateAsync(t => t.Id == id, t => new BlogArticle() { MDate = DateTime.Now.ToLocalTime() }) == 0 ? 200 : 400; r.msg = r.status == 200 ? "更新成功" : "更新失败"; } catch (Exception ex) { r.status = 500; r.msg = ex.Message; } return(r); }