public ActionResult PunchClockOut(PunchedClock model) { var userId = User.Identity.GetUserId(); model = _clockService.ClockOut(model.Id, DateTime.UtcNow); return(RedirectToRoute("Index")); }
public PunchedClock ClockIn(string userId, DateTime time) { var model = new PunchedClock { ApplicationUserId = userId, PunchIn = time }; _context.PunchedClocks.Add(model); _context.SaveChanges(); return(model); }
public ActionResult PunchClock() { var userId = User.Identity.GetUserId(); var model = _clockService.GetClockByUser(userId); if (model == null) { model = new PunchedClock { PunchIn = DateTime.MinValue }; ViewData["Message"] = "Clock In"; return(View(model)); } ViewData["Message"] = "Clock Out"; return(View(model)); }