예제 #1
0
        public HttpResponseMessage AddRotationInterval(string AuthToken, string RotationIntervalValues)
        {
            try
            {
                var User = UserRepository.RefreshAuthToken(AuthToken);

                var RotationIntervalObject = JsonConvert.DeserializeObject <RotationInterval>(RotationIntervalValues);

                if (!ChoreRepository.CanEditChoreList(User.Id, RotationIntervalObject.ChoreListId))
                {
                    throw new Exception("Not Authorized");
                }

                RotationIntervalObject.IsActive = true;

                return(OKResponse(new _RotationInterval(ChoreRepository.AddRotationInterval(RotationIntervalObject))));
            }
            catch (Exception ex)
            {
                return(ErrorResponse(ex));
            }
        }