Пример #1
0
        public IHttpActionResult RequestDeliverables(Guid rid)
        {
            DesignReview dbReview = UOW.DesignReviews.GetOwnById(rid, UserRecord.Id);

            if (dbReview == null)
            {
                throw new HttpResponseException(HttpStatusCode.NotFound);
            }

            dbReview.RequestById   = UserIdentityId;
            dbReview.RequestByName = UserRecord.FullName;
            dbReview.RequestByIp   = ""; // TODO djw: record requesting users IP address
            dbReview.RequestType   = RequestType.Deliverables;
            dbReview.RequestDate   = DateTime.UtcNow;

            UOW.Commit();

            IDictionary <string, string> formData = new Dictionary <string, string>();

            formData.Add("User", UserRecord.FullName);
            formData.Add("Project", dbReview.Project.Name);
            formData.Add("Review", dbReview.Title);
            formData.Add("Request Type", "Deliverables");
            MailService.SendNotification(formData, "Skyberry Notification: Deliverables Request");

            ReviewRequestVM reviewRequestVM = new ReviewRequestVM
            {
                RequestById   = dbReview.RequestById,
                RequestByName = dbReview.RequestByName,
                RequestByIp   = dbReview.RequestByIp,
                RequestType   = dbReview.RequestType,
                RequestDate   = dbReview.RequestDate,
            };

            return(new SkyApiPayload <ReviewRequestVM>(Request, reviewRequestVM));
        }
        public IHttpActionResult RequestRevision(Guid rid)
        {
            DesignReview dbReview = UOW.DesignReviews.GetOwnById(rid, UserRecord.Id);
            if (dbReview == null)
            {
                return new SkyApiNotFound(Request);
            }

            dbReview.RequestById = UserIdentityId;
            dbReview.RequestByName = UserRecord.FullName;
            dbReview.RequestByIp = ""; // TODO djw: record requesting users IP address
            dbReview.RequestType = RequestType.Revision;
            dbReview.RequestDate = DateTime.UtcNow;

            UOW.Commit();

            IDictionary<string, string> formData = new Dictionary<string, string>();
            formData.Add("User", UserRecord.FullName);
            formData.Add("Project", dbReview.Project.Name);
            formData.Add("Review", dbReview.Title);
            formData.Add("Request Type", "Revision");
            MailService.SendNotification(formData, "Skyberry Notification: Revision Request");

            ReviewRequestVM reviewRequestVM = new ReviewRequestVM
            {
                RequestById = dbReview.RequestById,
                RequestByName = dbReview.RequestByName,
                RequestByIp = dbReview.RequestByIp,
                RequestType = dbReview.RequestType,
                RequestDate = dbReview.RequestDate,
            };

            return new SkyApiPayload<ReviewRequestVM>(Request, reviewRequestVM);
        }