示例#1
0
        public HttpResponseMessage UpdateChoreList(string AuthToken, int ChoreListId, string Name, int StatusId)
        {
            try
            {
                ChoreList ChoreListObject = new ChoreList
                {
                    Id       = ChoreListId,
                    Name     = Name,
                    StatusId = StatusId
                };

                var User = UserRepository.RefreshAuthToken(AuthToken);

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

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