示例#1
0
        public string AddSubject(string jsonString = "{\"id_class\":\"2\",\"id_group\":\"\",\"id_teaher\":\"1\",\"name\":\"Francuski\"}")
        {
            AddSubjectPostViewModel addSubject = JsonConvert.DeserializeObject <AddSubjectPostViewModel>(jsonString);
            Subject s = new Subject()
            {
                Person                        = db.GetPerson(addSubject.ID_Teaher),
                Group                         = addSubject.ID_Group != null?db.GetGroup(addSubject.ID_Group) : null,
                                        Class = db.GetClass(addSubject.ID_Class),
                                        Name  = addSubject.Name
            };

            db.AddSubject(s);
            return("Dodano");
        }