Ejemplo n.º 1
0
        public IActionResult CheckIn(int memberID, int practiceID, int paymentType, decimal paymentAmount)
        {
            var attendance = new Attendance
            {
                MemberID      = memberID,
                PracticeID    = practiceID,
                PaymentType   = paymentType,
                PaymentAmount = paymentAmount
            };

            if (paymentType == 2)
            {
                var punchCard = _punchCardRepository.GetUsablePunchCard(memberID);
                _attendanceRepository.AddAttendance(attendance, punchCard);
            }
            else
            {
                _attendanceRepository.AddAttendance(attendance);
            }
            var attendanceMembersViewModel = new AttendanceMembersViewModel
            {
                PracticeID = practiceID,
                Members    = _memberRepository.GetPracticeMemberList(practiceID).ToList()
            };

            return(PartialView("_Members", attendanceMembersViewModel));
        }
Ejemplo n.º 2
0
        public async Task <IActionResult> AddAttendance(AttendanceResource AttendanceResource)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            var AttendanceToAdd = _mapper.Map <AttendanceResource, Attendance>(AttendanceResource);

            _repo.AddAttendance(AttendanceToAdd);
            await _unitofwork.CompleteAsync();

            return(StatusCode(201));
        }
Ejemplo n.º 3
0
        public async Task <IActionResult> Post(List <AttendanceDtoForAdd> list)
        {
            //if (await _repo.AttendanceExists(attendance.UserId))
            //    return BadRequest(new { message = "Attendance Already Exist" });
            _response = await _repo.AddAttendance(list);

            return(Ok(_response));
        }
        public AttendanceResponseModel AddAttendance(int registrationNumber)
        {
            Users user = _userRepository.GetUserByRegNumb(registrationNumber);

            if (user != null)
            {
                Attendance attendance = new Attendance
                {
                    Id                 = Guid.NewGuid(),
                    UserId             = user.Id,
                    RegistrationNumber = registrationNumber,
                    Date               = DateTime.Now,
                    CreatedOn          = DateTime.Now
                };
                return(_attendanceRepository.AddAttendance(attendance));
            }
            return(new AttendanceResponseModel
            {
                Status = false,
                Message = "Enter correct registration number / Fingerprint does not matched"
            });
        }
Ejemplo n.º 5
0
 public async Task <int> AddAttendance(AttendanceDTO attendance)
 {
     return(await _attendanceRepository.AddAttendance(attendance));
 }