Exemplo n.º 1
0
        public new void AsJson(JsonWriter writer, string baseUrl)
        {
            writer.WriteStartObject();
            base.AsJson(writer, baseUrl);

            if (User != null)
            {
                writer.WritePropertyName("user");
                User.AsJsonReference(writer, baseUrl);
            }

            if (IMSClass != null)
            {
                writer.WritePropertyName("class");
                IMSClass.AsJsonReference(writer, baseUrl);
            }

            if (School != null)
            {
                writer.WritePropertyName("school");
                School.AsJsonReference(writer, baseUrl);
            }

            writer.WritePropertyName("role");
            writer.WriteValue(Enum.GetName(typeof(RoleType), Role));

            if (Primary != null)
            {
                writer.WritePropertyName("primary");
                writer.WriteValue(Primary.ToString());
            }

            if (BeginDate != null)
            {
                writer.WritePropertyName("beginDate");
                writer.WriteValue(BeginDate.ToString("yyyy-MM-dd"));
            }

            if (EndDate != null)
            {
                writer.WritePropertyName("endDate");
                writer.WriteValue(EndDate.ToString("yyyy-MM-dd"));
            }

            writer.WriteEndObject();
            writer.Flush();
        }
        public new void AsJson(JsonWriter writer, string baseUrl)
        {
            writer.WriteStartObject();
            base.AsJson(writer, baseUrl);

            writer.WritePropertyName("title");
            writer.WriteValue(Title);

            if (!String.IsNullOrEmpty(Description))
            {
                writer.WritePropertyName("description");
                writer.WriteValue(Description);
            }

            writer.WritePropertyName("assignDate");
            writer.WriteValue(AssignDate.ToString("yyyy-MM-dd"));

            writer.WritePropertyName("dueDate");
            writer.WriteValue(DueDate.ToString("yyyy-MM-dd"));

            writer.WritePropertyName("category");
            LineItemCategory.AsJsonReference(writer, baseUrl);

            writer.WritePropertyName("class");
            IMSClass.AsJsonReference(writer, baseUrl);

            writer.WritePropertyName("gradingPeriod");
            AcademicSession.AsJsonReference(writer, baseUrl);

            writer.WritePropertyName("resultValueMin");
            writer.WriteValue(ResultValueMin.ToString());

            writer.WritePropertyName("resultValueMax");
            writer.WriteValue(ResultValueMax.ToString());

            writer.WriteEndObject();
            writer.Flush();
        }