示例#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);
     links = tasks.Select(task => Link.Create((Task)task, hostName));
 }
示例#4
0
 public TaskListModel(IEnumerable<Task> tasks, string hostName)
 {
     _self = Link.Create(this, hostName);
     _items = tasks.Select(task => TaskListItemModel.Create(task, hostName));
 }