Exemplo n.º 1
0
        // PUT api/reviewindex/5
        public HttpResponseMessage Put(int id, string patch, ReviewIndex index)
        {
            HttpResponseMessage response;
            var username = GetAPIUser();

            try
            {
                switch (patch)
                {
                case "assign-reviewer":
                    _manager.AssignReviewer(id, index.Reviewer, username);
                    break;

                default:
                    _manager.Edit(index.ToSession(_manager.ReadContext), username);
                    break;
                }

                response = GetResponse(id.ToNullSafeString());
            }
            catch (Exception e)
            {
                response = GetResponse(e);
            }

            return(response);
        }
Exemplo n.º 2
0
        // POST api/reviewindex
        public HttpResponseMessage Post(ReviewIndex index)
        {
            log.Info("A new review session has been posted");

            HttpResponseMessage response;
            var username = GetAPIUser();
            var session  = index.ToNewSession();

            try
            {
                _manager.Create(session, username);
                response = GetResponse(session.Id.ToNullSafeString());
            }
            catch (Exception e)
            {
                response = GetResponse(e);
            }

            return(response);
        }