/// <summary> /// updates the chore status. /// </summary> /// <param name="bankTransaction">The bank tranaction identifier</param> /// <param name="choreStatus">The chore status</param> private void UpdateChoreStatus(int bankTransactionId, ChoreStatus choreStatus) { var chores = Repository.Table <Chore>().Where(m => m.BankTransactionID == bankTransactionId).ToList(); foreach (var chore in chores) { chore.ChoreStatus = choreStatus; Repository.Update(chore); } }
/// <summary> /// Gets the chore count. /// </summary> /// <param name="choreDueType">The chore type</param> /// <param name="familyMemberId">Family member identifier</param> /// <param name="choreStatus">Chore status</param> /// <returns>The chore count.</returns> public int GetChoreCount(ChoreDueType choreDueType, int?familyMemberId = null, ChoreStatus choreStatus = ChoreStatus.Active) { familyMemberId = familyMemberId.HasValue ? familyMemberId : _currentUserService.MemberID; var choresQuery = Repository.Table <Chore>().Where(m => m.FamilyMemberID == familyMemberId && !m.IsDeleted && !m.FamilyMember.IsDeleted); var todayDate = DateTime.UtcNow.Date; switch (choreDueType) { case ChoreDueType.Overdue: choresQuery = choresQuery.Where(m => m.ChoreStatus == choreStatus && DbFunctions.TruncateTime(m.DueDate) < todayDate); break; case ChoreDueType.Today: choresQuery = choresQuery.Where(m => m.ChoreStatus == choreStatus && DbFunctions.TruncateTime(m.DueDate) == todayDate); break; case ChoreDueType.Upcoming: choresQuery = choresQuery.Where(m => m.ChoreStatus == choreStatus && DbFunctions.TruncateTime(m.DueDate) > todayDate); break; } return(choresQuery.Count()); }