public bool SetPresence(int sessionID, int attendeeId) { if (!userServices.GetSessionAttendes(sessionID).Any(x => x.Id == attendeeId)) { throw new Exception("Attendee do not exist in formation"); } if (!userServices.GetSession(sessionID).SessionDays.Any(x => x.DaySession.IsSameDate(DateTime.Now))) { throw new Exception("Not a formation day"); } try { var presence = new AttendeePresenceTO { SessionId = sessionID, AttendeeId = attendeeId, PresenceDay = new List <DateTime> { DateTime.Now } }; if (presenceRepository.Add(presence).Id <= 0) { return(false); } } catch (Exception) { throw; } return(true); }
public AttendeePresenceTO SuperAddMethod(AttendeePresenceTO Entity) { //var to = attendanceContext.AttendeePresents.Add(null); //.Entity.ToTransfertObject(); return(null); //to; }