Esempio n. 1
0
        public HttpResponseMessage DeleteChoreUser(string AuthToken, int Id)
        {
            try
            {
                var User = UserRepository.RefreshAuthToken(AuthToken);

                //get ChoreUser
                var ChoreUser = ChoreRepository.GetChoreUser(Id);

                //check if userid matches chore list object user
                if (!ChoreRepository.CanEditChoreList(User.Id, ChoreUser.ChoreListId))
                {
                    throw new Exception("Unathorized");
                }

                return(OKResponse(new _ChoreUser(ChoreRepository.DeleteChoreUser(Id))));
            }
            catch (Exception ex)
            {
                return(ErrorResponse(ex));
            }
        }