public JsonResult AssignAgentUserIds(string app, string start, string end, string agent) { int userId = -1; string token = ""; bool result = false; string message = string.Empty; if (GetToken(out userId, out token)) { int a, s, e, ag; if (int.TryParse(app, out a) && int.TryParse(start, out s) && int.TryParse(end, out e) && int.TryParse(agent, out ag)) { DSClient client = new DSClient(Models.Const.ApplicationId); try { client.AssignAgentUserIds(userId, token, a, s, e, ag); result = true; } catch (DatabaseException exception) { message = exception.Message; } } } return(Json(new { Success = result, Message = message }, JsonRequestBehavior.AllowGet)); }