public ActionResult AddTeacher(Teacher model) { IRepositories repositories = new RepositoryFactory(); repositories.TeacherRepository.Insert(Convert(model)); repositories.Commit(); return RedirectToAction("Index"); }
public ActionResult AddItem(Item model) { IRepositories repositories = new RepositoryFactory(); new ScheduleManager(repositories).AddItem(model.ScheduleId, ItemConvertor(model)); repositories.Commit(); return RedirectToAction("Schedule", new{id = model.DataId}); }
public ActionResult AddItem(Guid? scheduleId, int dayNumber, int subgroupNumber, int order, Guid groupId) { var repositories = new RepositoryFactory(); var scheduleManager = new ScheduleManager(repositories); if (scheduleId == null) { var schedule = new DBLE.Schedule { Id = Guid.NewGuid(), Items = new List<DBLE.Item>() }; scheduleManager.AddGroupSchedule(groupId, schedule, subgroupNumber); repositories.Commit(); return View(new Item { Id = Guid.NewGuid(), ScheduleId = (Guid)schedule.Id, DataId = groupId, Order = order, NumberOfDay = dayNumber }); } return View(new Item { Id = Guid.NewGuid(), ScheduleId = (Guid)scheduleId, DataId = groupId, Order = order, NumberOfDay = dayNumber }); }
public ActionResult AddStudent(Student model) { IRepositories repositories = new RepositoryFactory(); DBLE.Student student = StudentConverter(model); student.Id = Guid.NewGuid(); new GroupManager(repositories).AddStudent(model.GroupId, student); repositories.Commit(); return RedirectToAction("Students", new { id = model.GroupId }); }
public ActionResult DeleteItem(Guid itemId, Guid dataId) { IRepositories repositories = new RepositoryFactory(); repositories.ItemRepository.Delete(itemId); repositories.Commit(); return RedirectToAction("Schedule", new { id = dataId }); }
public ActionResult DeleteGroup(Guid id) { IRepositories repositories = new RepositoryFactory(); repositories.GroupRepository.Delete(id); repositories.Commit(); return RedirectToAction("Index"); }
public ActionResult Students(Guid id) { IRepositories repositories = new RepositoryFactory(); var students = new List<Student>(); (new GroupManager(repositories).GetStudents(id)).ForEach(st => students.Add(new Student(st))); repositories.Commit(); return View(new DataContainer<List<Student>>(students, id)); }
public ActionResult Index(string groupName) { IRepositories repositories = new RepositoryFactory(); DBLE.Group gGroup = new DBLE.Group { Id = Guid.NewGuid(), Name = groupName, Students = new List<DBLE.Student>() }; repositories.GroupRepository.Insert(gGroup); repositories.Commit(); return RedirectToAction("Index"); }
public ActionResult EditStudent(Student model) { IRepositories repositories = new RepositoryFactory(); DBLE.Student student = StudentConverter(model); student.Id = model.Id; repositories.StudentRepository.Update(student); repositories.Commit(); return RedirectToAction("Students", new { id = model.GroupId }); }
public ActionResult EditItem(Item model) { IRepositories repositories = new RepositoryFactory(); DBLE.Item item = ItemConvertor(model); item.Id = model.Id; repositories.ItemRepository.Update(item); repositories.Commit(); return RedirectToAction("Schedule", new {id = model.DataId}); }
//studentId public ActionResult DeleteStudent(Guid groupId, Guid studentId) { IRepositories repositories = new RepositoryFactory(); new GroupManager(repositories).DeleteStudent(studentId); repositories.Commit(); return RedirectToAction("Students", new { id = groupId }); }
public ActionResult DeleteTeacher(Guid teacherId) { IRepositories repositories = new RepositoryFactory(); new GroupManager(repositories).DeleteStudent(teacherId); repositories.Commit(); return RedirectToAction("Index"); }