public ActionResult OnlyTimes(DateTimeOffset? fromTime, DateTimeOffset? toTime) { var timeline = new TimelineDto(); if (fromTime.HasValue && toTime.HasValue && fromTime < toTime) { var activity = new ActivityDto(); activity.StartTime = new DateTimeOffset(fromTime.Value.Year, fromTime.Value.Month, fromTime.Value.Day, 12, 0, 0, fromTime.Value.Offset); activity.EndTime = activity.StartTime.AddHours(1); timeline.Activities = new[] { activity }; } return Content(HelperFunctions.ToXml(timeline), "text/xml"); }
public ActionResult TimesAndTitle(DateTimeOffset? fromTime, DateTimeOffset? toTime) { var timeline = new TimelineDto(); if (fromTime.HasValue && toTime.HasValue && fromTime < toTime) { var activity = new ActivityDto(); activity.StartTime = new DateTimeOffset(fromTime.Value.Year, fromTime.Value.Month, fromTime.Value.Day, 12, 0, 0, fromTime.Value.Offset); activity.EndTime = activity.StartTime.AddHours(1); activity.DisplayName = "My activity"; timeline.Activities = new[] { activity }; timeline.Color = HelperFunctions.GetRandomColor(); } return Content(HelperFunctions.ToXml(timeline), "text/xml"); }
public ActionResult ActivitiesAndGroups(DateTimeOffset? fromTime, DateTimeOffset? toTime) { var timeline = new TimelineDto(); if (fromTime.HasValue && toTime.HasValue && fromTime < toTime) { var groups = new List<GroupDto>() { new GroupDto() { Color = HelperFunctions.GetRandomColor(), DisplayKey = "MyGroup1", DisplayName = "My Activity Group", GroupId = "1" }, new GroupDto() { } }; var group = new GroupDto(); group.Color = HelperFunctions.GetRandomColor(); group.DisplayName = "My Group"; group.DisplayKey = "MyGroup"; group.GroupId = "1"; var activity = new ActivityDto(); // activity.StartTime = new DateTimeOffset(fromTime.Value.Year, fromTime.Value.Month, fromTime.Value.Day, 12, 0, 0, fromTime.Value.Offset); activity.StartTime = new DateTimeOffset(fromTime.Value.AddMinutes(-10).Ticks, fromTime.Value.Offset); activity.EndTime = activity.StartTime.AddMinutes(30); activity.DisplayName = "My activity"; activity.GroupId = group.GroupId; timeline.Activities = new[] { activity }; timeline.Groups = new[] { group }; timeline.Color = HelperFunctions.GetRandomColor(); } return Content(HelperFunctions.ToXml(timeline), "text/xml"); }