using Marco.Pms.DataAccess.Data; using Marco.Pms.DataAccess.Repository.IRepository; using Marco.Pms.Model.Employees; using Marco.Pms.Model.Entitlements; using MarcoBMS.Services.Service; using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Identity; using Microsoft.AspNetCore.Mvc; using Microsoft.EntityFrameworkCore; namespace MarcoBMS.Services.Controllers { [Route("api/[controller]")] [ApiController] [Authorize] public class ActivityController : ControllerBase { private readonly ApplicationDbContext _context; private ApplicationUser _applicationUser; private readonly IEmployeeRepository _empRepo; private readonly UserManager _userManager; private readonly IEmailSender _emailSender; public ActivityController(UserManager userManager, IEmailSender emailSender, IEmployeeRepository empRepo, ApplicationDbContext context) { _context = context; _empRepo = empRepo; _userManager = userManager; _emailSender = emailSender; } //[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." }); //} } }