Пример #1
0
        public static SubjectViewModel ToViewModel(this Subject model)
        {
            var viewModel = new SubjectViewModel();
            viewModel.InjectFrom(model);

            return viewModel;
        }
Пример #2
0
        public ActionResult Add(SubjectViewModel model)
        {
            if (ModelState.IsValid)
            {
                var teacherID = this.HttpContext.Cache.GetTeacherID();
                if (teacherID != null)
                {
                    var subject = model.ToModel();
                    this._subjectManager.AddSubjectForTeacher(subject, teacherID);

                    return this.Json(new { success = true });
                }

                return HttpNotFound();
            }

            return this.Json(new {success = false});
        }