public async Task <ActionResult> PutCheckin(int id) { var userId = User.GetUserId(); var dbActivity = _allReadyDataAccess.GetActivity(id); if (dbActivity == null || dbActivity.UsersSignedUp == null) { return(this.HttpNotFound()); } var userSignup = dbActivity.UsersSignedUp.FirstOrDefault(u => u.User.Id == userId); if (userSignup != null && userSignup.CheckinDateTime == null) { userSignup.CheckinDateTime = DateTime.UtcNow; await _allReadyDataAccess.AddActivitySignupAsync(userSignup); return(Json(new { Activity = new { Name = dbActivity.Name, Description = dbActivity.Description } })); } else { return(Json(new { NeedsSignup = true, Activity = new { Name = dbActivity.Name, Description = dbActivity.Description } })); } }
protected override async Task HandleCore(AddActivitySignupCommandAsync message) { await dataAccess.AddActivitySignupAsync(message.ActivitySignup); }