public void addRequirement(HttpContext context) { context.Response.ContentType = "text/plain"; Requirement requirement = new Requirement(); requirement.RequirementName = context.Request["Name"]; requirement.RequirementDesc = context.Request["Desc"]; requirement.RequirementCategory.Id = Convert.ToInt32(context.Request["CategoryId"]); requirement.User.Id = Convert.ToInt32(context.Session["userId"]); Dictionary <String, Object> dictionary = new Dictionary <string, object>(); int id = requirementService.addRequirement(requirement); if (id > 0) { dictionary.Add("Id", id); dictionary.Add("success", "true"); } else { dictionary.Add("success", "false"); } context.Response.Write(JsonUtil.toJson(dictionary).ToString()); }