using Marco.Pms.DataAccess.Data; using Marco.Pms.Model.Entitlements; using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Identity; using Microsoft.AspNetCore.Mvc; namespace ModelServices.Controllers { [Route("api/[controller]")] [ApiController] [Authorize] public class ActivityController : ControllerBase { private readonly ApplicationDbContext _context; private ApplicationUser _applicationUser; private readonly UserManager _userManager; public ActivityController(UserManager userManager, ApplicationDbContext context) { _context = context; _userManager = userManager; } //[HttpPost("checkin")] //public async Task CheckIn(int employeeId, string latitude, string longitude) //{ // var now = DateTime.UtcNow; // var date = now.Date; // var attendanceLog = new AttendanceLog // { // EmployeeID = employeeId, // //InTime = now, // Latitude = latitude, // Longitude = longitude // }; // _context.AttendanceLogs.Add(attendanceLog); // var attendance = await _context.Attendances // .FirstOrDefaultAsync(a => a.EmployeeID == employeeId && a.Date == date); // if (attendance == null) // { // attendance = new Attendance // { // EmployeeID = employeeId, // Date = date, // InTimeLog = attendanceLog // }; // _context.Attendances.Add(attendance); // } // await _context.SaveChangesAsync(); // return Ok(new { Message = "Check-in recorded." }); //} } }