Example #1
0
        public void Remove(Guid id)
        {
            SyllabusTable syllabusTable = GetById(id);

            syllabusTable.Status = DAL.Entity.Enum.Status.Deleted;
            Update(syllabusTable);
        }
 public ActionResult Delete(SyllabusTable syllabusTable)
 {
     try
     {
         syllabusTableService.Remove(syllabusTable.ID);
         return(RedirectToAction(nameof(Index)));
     }
     catch
     {
         return(View());
     }
 }
 public ActionResult Edit(SyllabusTable syllabusTable)
 {
     if (ModelState.IsValid)
     {
         syllabusTableService.Update(syllabusTable);
         return(RedirectToAction("Index"));
     }
     else
     {
         return(View());
     }
 }
        public ActionResult Create(SyllabusTable model)
        {
            if (ModelState.IsValid)
            {
                syllabusTableService.Add(model);

                TeacherSyllabusTable teacherSyllabusTable = new TeacherSyllabusTable()
                {
                    TeacherID       = model.TeacherID,
                    SyllabusTableID = model.ID,
                };
                teacherSyllabusTableService.Add(teacherSyllabusTable);

                return(RedirectToAction("Index"));
            }
            else
            {
                return(View());
            }
        }
Example #5
0
 public void Update(SyllabusTable syllabusTable)
 {
     context.Entry(syllabusTable).State = Microsoft.EntityFrameworkCore.EntityState.Modified;
     context.SaveChanges();
 }
Example #6
0
 public void Add(SyllabusTable syllabusTable)
 {
     context.SyllabusTables.Add(syllabusTable);
     context.SaveChanges();
 }