Пример #1
0
 public static Link Create(Task task, string hostName)
 {
     var link = new Link
     {
         Rel = "item",
         HRef = string.Format("http://{0}/{1}/{2}", hostName, "task", task.Id)
     };
     return link;
 }
Пример #2
0
        public static Link Create(TaskListModel taskList, string hostName)
        {
            //we don't need to use taskList to build the self link
            var self = new Link
            {
                Rel = "self",
                HRef = string.Format("http://{0}/{1}", hostName, "tasks")
            };

            return self;
        }
Пример #3
0
 public TaskListModel(IEnumerable<Task> tasks, string hostName)
 {
     _self = Link.Create(this, hostName);
     _items = tasks.Select(task => TaskListItemModel.Create(task, hostName));
 }