public IHttpActionResult Delete(int id) { ApiResData res = new ApiResData(); try { if (!ModelState.IsValid) { rs.SetErrorStatus(eFunc.fg.SFailed); resObj = JObject.FromObject(res.ResCUD(new object[] { rs }, eFunc.fg.Delete, new Exception(eFunc.fg.DataNf))); return(Content(HttpStatusCode.NotFound, resObj)); } rs = repo.Delete(id, "System", CurrentUser.GetCurrentDateTime()); if (rs.IsSuccess) { rs.SetSuccessStatus(); } else { rs.SetErrorStatus(eFunc.fg.SFailed); } resObj = JObject.FromObject(res.ResCUD(new object[] { rs }, eFunc.fg.Delete, null)); return(Content(HttpStatusCode.OK, resObj)); } catch (Exception ex) { rs.SetErrorStatus(ex.Message); resObj = JObject.FromObject(res.ResCUD(new object[] { rs }, eFunc.fg.Delete, new Exception(eFunc.fg.DFailed))); return(Content(HttpStatusCode.BadRequest, resObj)); } }
/// <summary> /// 删除一个实体 /// </summary> /// <param name="_entity"></param> /// <returns></returns> public int Delete(int Id) { return(dal.Delete(Id)); }