public ActionResult StudioAssignAdminOrAccountant(StudioAssignViewModel model) { var api = GoPlayApi.Instance; var studio = api.GetStudio(model.studio.id).Data; if (studio == null) { this.Flash(string.Format("Studio with id {0} doesn't exist", model.studio.id), FlashLevel.Warning); return Redirect("/admin/studio"); } if (!string.IsNullOrEmpty(model.username)) { StringBuilder condition = new StringBuilder(); string encodeForLike = model.username.Replace("%", "[%]").Replace("[", "[[]").Replace("]", "[]]"); string termUsername = "******" + encodeForLike + "%'"; condition.AppendLine(string.Format(@"AND (lower(ca.email) LIKE {0} OR lower(ca.nickname) LIKE {0} OR lower(ca.username) LIKE {0})", termUsername)); string subselectStudio = "SELECT game_admin_id FROM studio_admin_assignment WHERE studio_id = " + model.studio.id; string subselect = "SELECT distinct customer_account_id FROM auth_assignment WHERE customer_account_id IN (" + subselectStudio + ")"; condition.AppendLine(@" AND ca.id NOT IN (" + subselect + ")"); model.admins = api.GetCustomerAccountsByCondition(condition.ToString()).Data; } return View(model); }
public ActionResult StudioAssignAdminOrAccountant(int id) { var api = GoPlayApi.Instance; var studio = api.GetStudio(id).Data; if (studio == null) { this.Flash(string.Format("Studio with id {0} doesn't exist", id), FlashLevel.Warning); return Redirect("/admin/studio"); } StudioAssignViewModel model = new StudioAssignViewModel() { studio = studio }; return View(model); }