public void AddSubject(Subjects entityToAdd) { ISubjectsRepository repo = new SubjectsRepository(getEntities()); Entities.Subjects entityToAdd2 = Mapper.Map <Subjects, Entities.Subjects>(entityToAdd); repo.Add(entityToAdd2); }
public IHttpActionResult Create(Subject subject) { bool created = subRepo.Add(subject); if (created == false) { return(BadRequest()); } return(Ok(subject)); }
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();
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()); } }