/// <summary> /// Module added to event for attendence /// </summary> /// <param name="modules"></param> /// <param name="eventId"></param> /// <returns></returns> public bool AddModulesToEvent(List<CourseModule> modules, int eventId) { if (modules.Count != 0 && eventId != 0) { foreach (var m in modules) { //new event module id generted var eventModuleId = ModuleEventsIdGeneration() ; //new event module created var eventModule = new ModuleEvent { EventId = eventId, ModuleId = m.Module, EventModule = eventModuleId, CourseId = m.Course }; //event mdouel adde to database _dBase.ModuleEvents.Add(eventModule); _dBase.SaveChanges(); } return true; } return false; }
/// <summary> /// Creation of module attendees for event /// </summary> /// <param name="eventId"></param> /// <param name="moduleId"></param> /// <param name="courseId"></param> /// <returns></returns> public bool ModuleEvent(int eventId, int moduleId, int courseId) { //check ids that have been passed in are valid if (eventId != 0 && moduleId != 0 && courseId != 0) { //Id generated var inviteId = ModuleEventsIdGeneration(); // new module event object created var moduleEvent = new ModuleEvent { EventModule = inviteId, ModuleId = moduleId, CourseId = courseId, EventId = eventId }; _dBase.ModuleEvents.Add(moduleEvent); _dBase.SaveChanges(); return true; } //Ids passed in invalid i.e contain 0s return false; }