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