Models for demos

2 posts, 0 answers
  1. Jesse
    Jesse avatar
    6 posts
    Member since:
    Jan 2008

    Posted 23 Sep 2015 Link to this post

    I am creating a treeview, loaded from remote hierarchical data, similar to

    http://demos.telerik.com/aspnet-mvc/treeview/remote-data-binding

    I am trying to understand this line in the controller:

     hasChildren = e.Employees1.Any()

    I assume that the employee model has a property where it checks for children.  Where can I actually look at the model?  Can I download all the demos along with the data model?

     

     

  2. Eduardo Serra
    Admin
    Eduardo Serra avatar
    51 posts

    Posted 23 Sep 2015 Link to this post

    Hi Jesse,

    This is the complete Employee model used in the MVC examples:

    01.public partial class Employee
    02.    {
    03.        public Employee()
    04.        {
    05.            this.Employees1 = new HashSet<Employee>();
    06.            this.Orders = new HashSet<Order>();
    07.            this.Territories = new HashSet<Territory>();
    08.        }
    09.     
    10.        public int EmployeeID { get; set; }
    11.        public string LastName { get; set; }
    12.        public string FirstName { get; set; }
    13.        public string Title { get; set; }
    14.        public string TitleOfCourtesy { get; set; }
    15.        public Nullable<System.DateTime> BirthDate { get; set; }
    16.        public Nullable<System.DateTime> HireDate { get; set; }
    17.        public string Address { get; set; }
    18.        public string City { get; set; }
    19.        public string Region { get; set; }
    20.        public string PostalCode { get; set; }
    21.        public string Country { get; set; }
    22.        public string HomePhone { get; set; }
    23.        public string Extension { get; set; }
    24.        public byte[] Photo { get; set; }
    25.        public string Notes { get; set; }
    26.        public Nullable<int> ReportsTo { get; set; }
    27.        public string PhotoPath { get; set; }
    28.     
    29.        public virtual ICollection<Employee> Employees1 { get; set; }
    30.        public virtual Employee Employee1 { get; set; }
    31.        public virtual ICollection<Order> Orders { get; set; }
    32.        public virtual ICollection<Territory> Territories { get; set; }
    33.    }

    As you can see, Employee1 is a HashSet of Employee objects that allows us to have a list without duplicates of all the employees that work under another. In the case of hasChildren = e.Employees1.Any() we are checking if there is at least one Employee in the HashSet.

    There are two ways to get the source code for all the MVC demos. The first one is to get them through the Telerik Control Panel: after you select to update or install UI for ASP.NET MVC and hit proceed, check the Local Demos box and finish the rest of the process. The second way is to go to Your Account page in Telerik's website and find ​UI for ASP.NET MVC under your products list, select Browse all product files and download the Manual Installation compressed file; it contains the Kendo.Mvc.Examples solution.

    I hope this helps.

    Regards,
    Eduardo Serra
    Telerik
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
  3. UI for ASP.NET MVC is VS 2017 Ready
Back to Top