public IHttpActionResult Delete(string ids) { var ous = _AuthorityOuDal.Get(); int id = 0; string[] arrayId = ids.Split(','); foreach (string item in arrayId) { if (int.TryParse(item, out id)) { // 将直接子机构关系删除 foreach (AuthorityOu ou in ous.Where(o => o.pid == id).ToList()) { ou.pid = 0; ou.path = ou.path.Replace("," + id + ",", "").Replace("," + id, "").Replace(id + ",", ""); _AuthorityOuDal.Update(ou); } // 逻辑删除该机构 AuthorityOu model = ous.FirstOrDefault(o => o.id == id); model.isDelete = true; _AuthorityOuDal.Update(model); } } return(Ok("删除成功!")); }
public IHttpActionResult Put([FromBody] AuthorityOu model) { return(Json(_AuthorityOuDal.Update(model))); }
public IHttpActionResult Post([FromBody] AuthorityOu model) { model.createTime = DateTime.Now; return(Json(_AuthorityOuDal.Add(model))); }