/// <summary>
        /// Logic to handle the mapping
        /// </summary>
        /// <param name="newDriverHostMappingViewModel"></param>
        /// <returns></returns>
        public async Task <bool> MapDriverToHost(NewDriverHostMappingViewModel newDriverHostMappingViewModel)
        {
            var host = await _hostLogic.Get(newDriverHostMappingViewModel.HostId);

            // Save changes to driver
            return(_driverLogic.Update(newDriverHostMappingViewModel.DriverId, x =>
            {
                // Add map
                x.Host = host;
                x.HostRefId = host.Id;
            }) != null);
        }
예제 #2
0
        /// <summary>
        /// Check-In all via an email
        /// </summary>
        /// <param name="entitiesEnum"></param>
        /// <param name="id"></param>
        /// <param name="present"></param>
        /// <returns></returns>
        public bool HandleEmailCheckIn(EntitiesEnum entitiesEnum, int id, bool present)
        {
            switch (entitiesEnum)
            {
            case EntitiesEnum.Student:
                _studentLogic.Update(id, student =>
                {
                    // Checked-in
                    student.IsPresent = present;
                });
                break;

            case EntitiesEnum.Driver:
                _driverLogic.Update(id, driver =>
                {
                    // Checked-in
                    driver.IsPresent = present;
                });
                break;

            default:
                throw new ArgumentOutOfRangeException(nameof(entitiesEnum), entitiesEnum, null);
            }

            return(true);
        }
예제 #3
0
        /// <summary>
        /// Set the attendance for driver
        /// </summary>
        /// <param name="attendanceViewModel"></param>
        /// <returns></returns>
        public async Task <bool> DriverSetAttendance(AttendanceViewModel attendanceViewModel)
        {
            // Set attendance
            await _driverLogic.Update(attendanceViewModel.Id, x =>
            {
                // Set attendance
                x.IsPresent = attendanceViewModel.Attendance;
            });

            return(true);
        }
        public async Task <IActionResult> EditHandler(Driver driver)
        {
            await _driverLogic.Update(driver.Id, driver);

            return(RedirectToAction("Index"));
        }