Exemplo n.º 1
0
        public HttpResponseMessage UpdateRotationInterval(string AuthToken, int Id, 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.UpdateRotationInterval(Id, RotationIntervalObject))));
            }
            catch (Exception ex)
            {
                return(ErrorResponse(ex));
            }
        }