Example #1
0
        private HttpResponseMessage ProcessNewEnglishTermRecord(HttpRequestMessage request, EnglishTermDTO uDto)
        {
            var ur = new EnglishTermRepository();

            //var EnglishTermRepository = new EnglishTermRepository();
            var EnglishTerm = new EnglishTerm();

            EnglishTerm.Term          = uDto.Term;
            EnglishTerm.BeforeOrAfter = uDto.BeforeOrAfter;
            EnglishTerm        = ur.Save(EnglishTerm);
            uDto.EnglishTermID = EnglishTerm.EnglishTermID.ToString();
            var response = request.CreateResponse(HttpStatusCode.Created, uDto);

            response.Headers.Location = new Uri(Url.Link("Default", new
            {
                id = EnglishTerm.EnglishTermID
            }));
            return(response);
        }
Example #2
0
        private HttpResponseMessage ProcessExistingEnglishTermRecord(HttpRequestMessage request, EnglishTermDTO cqDto, int contactId)
        {
            var ur = new EnglishTermRepository();
            //var EnglishTermRepository = new EnglishTermRepository();
            var EnglishTerm = new EnglishTerm();

            EnglishTerm = ur.GetById(contactId);
            //int? companyIdx = -1;
            //  is the EnglishTerm eligible to update the prospect?
            if (cqDto.Term != null)
            {
                EnglishTerm.Term = cqDto.Term;
            }
            if (cqDto.BeforeOrAfter != null)
            {
                EnglishTerm.BeforeOrAfter = cqDto.BeforeOrAfter;
            }
            ur.Save(EnglishTerm);
            return(request.CreateResponse(HttpStatusCode.Accepted, cqDto));
        }