public JsonResult Add(SysRoleView roleView) { db.SysRoles.Add(Mapper.Map <SysRole>(roleView)); db.SaveChanges(); return(Json(ResultInfo.Success(Lang.AddRoleInfoSuccess))); }
public JsonResult Delete(SysRoleView roleView) { db.SysRoles.Remove(db.SysRoles.Find(roleView.ID)); db.SaveChanges(); return(Json(ResultInfo.Success(Lang.DeleteRoleInfoSuccess))); }
/// <summary> /// 更新相应的多对多关系 /// </summary> /// <param name="obj"></param> private void UpdateRole(SysRoleView obj) { int[] orgIds = Array.ConvertAll(obj.OrganizationIds.Split(','), int.Parse); _revelanceApp.DeleteBy(Define.ROLEORG, obj.Id.Value); _revelanceApp.AddRelevance(Define.ROLEORG, orgIds.ToLookup(u => obj.Id.Value)); }