public HttpResponseMessage Add([FromBody] Chore chore, DayOfWeek choreCreatedDay) { if (chore == null) { throw new InvalidParameterException("Please provide a valid chore"); } if (_currentUserService.MemberType != MemberType.Admin && _currentUserService.MemberType != MemberType.Parent) { throw new UnauthorizedAccessException(); } chore = _choreService.Add(chore, null, choreCreatedDay); if (chore.FrequencyType != FrequencyType.Once) { _recurringChoreService.CreateChores(chore.FrequencyType, chore.Id, _currentUserService.FamilyID, false, choreCreatedDay); } return(Request.CreateResponse(HttpStatusCode.OK, chore)); }
public void Execute(IJobExecutionContext context) { _recurringChoreService.CreateChores(FrequencyType.Weekly, null, null, true); }