Example #1
0
        public void AddSubject(Subjects entityToAdd)
        {
            ISubjectsRepository repo = new SubjectsRepository(getEntities());

            Entities.Subjects entityToAdd2 = Mapper.Map <Subjects, Entities.Subjects>(entityToAdd);
            repo.Add(entityToAdd2);
        }
Example #2
0
        public IHttpActionResult Create(Subject subject)
        {
            bool created = subRepo.Add(subject);

            if (created == false)
            {
                return(BadRequest());
            }
            return(Ok(subject));
        }
Example #3
0
 private void subjectCreateButton_Click(object sender, EventArgs e) => new DetailedSubjectForm
 (
     null,
     TeachersRepository.GetAll(),
     newSubjectVM =>
 {
     var newSubjectId = SubjectsRepository.Add(newSubjectVM.Subject).Id;
     TeacherSubjectRepository.AddTeachersForSubject(newSubjectId, newSubjectVM.TeacherIds);
     UpdateSubjectsGrid();
     return(true);
 }
 ).Show();
Example #4
0
 public ActionResult Create(Subject subject)
 {
     try
     {
         bool success = sRepo.Add(subject);
         // TODO: Add insert logic here
         if (success)
         {
             return(RedirectToAction("Index"));
         }
         ViewBag.EMessage = "Subject already exists.";
         return(View());
     }
     catch
     {
         return(View());
     }
 }