Ejemplo n.º 1
0
        internal static ComplaintDiscussionsViewModel MapDiscussions(Post[] posts)
        {
            var result = new ComplaintDiscussionsViewModel();

            result.Replies = Mappers.MapPosts(posts);

            return result;
        }
        private ComplaintDiscussionsViewModel TryGetDiscussions(int id)
        {
            var result = new ComplaintDiscussionsViewModel();

            try
            {
                var discussions = this.Service.GetDiscussions(this.SecurityToken, id);
                return Mappers.MapDiscussions(discussions);
            }
            catch (ForbiddenException) { AddModelStateError(GlobalStrings.Forbidden); }
            catch (CaseDoesNotExistException) { AddModelStateError(GlobalStrings.CaseDoesNotExist); }
            catch (Exception) { AddModelStateError(GlobalStrings.SomethingWentWrong); }

            return result;
        }