コード例 #1
0
        //GET
        public string AddSubject()
        {
            var model   = new AddSubjectGetViewModel();
            var classes = db.GetClasses().Select(p => new Models.Class()
            {
                Id   = p.ID_Class,
                Name = p.Name
            });

            model.Classes.AddRange(classes);
            var groups = db.GetGroups().Select(p => new Models.Group()
            {
                Id   = p.ID_Gruop,
                Name = p.Name
            });

            model.Groups.AddRange(groups);
            var teahers = db.GetTeahers().Select(p => new Models.Teaher()
            {
                Id        = p.ID_Person,
                FirstName = p.FirstName,
                LastName  = p.LastName
            });

            model.Teahers.AddRange(teahers);

            return(JsonConvert.SerializeObject(model));
        }