Esempio n. 1
0
        public HttpResponseMessage AddRecipientsToJobFromList(int sourceListId, int jobId)
        {
            Job job = Job.Load(jobId);

            if (job == null)
            {
                return(Request.CreateErrorResponse(HttpStatusCode.NotFound, "Job not found"));
            }
            RecipientList sourceList = RecipientList.Load(sourceListId);

            if (sourceList == null)
            {
                return(Request.CreateErrorResponse(HttpStatusCode.NotFound, "Source list not found"));
            }

            int             addedAddresses = job.AddWorkItemsFromRecipientList(sourceList.Id);
            RecipientStatus status         = new RecipientStatus {
                ImportedEmails = addedAddresses
            };

            return(Request.CreateResponse(HttpStatusCode.OK, GetJsonResult <RecipientStatus>(status)));
        }