예제 #1
0
        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));
        }
예제 #2
0
 public void Execute(IJobExecutionContext context)
 {
     _recurringChoreService.CreateChores(FrequencyType.Weekly, null, null, true);
 }