Example #1
0
        public HttpResponseMessage CreateChoreList(string AuthToken, string ChoreListValues)
        {
            try
            {
                _User User = new _User(UserRepository.RefreshAuthToken(AuthToken));

                ChoreList ChoreListObject = JsonConvert.DeserializeObject <ChoreList>(ChoreListValues);

                //check if User Matches Id
                if (User.Id != ChoreListObject.UserId)
                {
                    throw new Exception("Unathorized");
                }

                return(OKResponse(new _ChoreList(ChoreRepository.CreateChoreList(ChoreListObject))));
            }
            catch (Exception ex)
            {
                return(ErrorResponse(ex));
            }
        }