コード例 #1
0
        public HttpResponseMessage DeleteChore(string AuthToken, int Id)
        {
            try
            {
                var User = UserRepository.RefreshAuthToken(AuthToken);

                var Chore = ChoreRepository.GetChore(Id);

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

                return(OKResponse(new _Chore(ChoreRepository.DeleteChore(Id))));
            }
            catch (Exception ex)
            {
                return(ErrorResponse(ex));
            }
        }