private HttpResponseMessage ProcessExistingEmailRecord(HttpRequestMessage request, EmailDTO cqDto, int contactId, string key, int EmailId, int userId) { var ur = new EmailRepository(); var user = new Email(); user = ur.GetById(contactId); var validationErrors = GetValidationErrors(ur, user, cqDto, EmailId, userId); if (validationErrors.Any()) { return(ProcessValidationErrors(request, validationErrors, key)); } ur.Save(user); cqDto.Key = key; return(request.CreateResponse(HttpStatusCode.Accepted, cqDto)); }
private HttpResponseMessage ProcessNewEmailRecord(HttpRequestMessage request, EmailDTO uDto, string key, int EmailId, int userId) { var ur = new EmailRepository(); var user = new Email(); var validationErrors = GetValidationErrors(ur, user, uDto, EmailId, userId); if (validationErrors.Any()) { return(ProcessValidationErrors(request, validationErrors, key)); } user = ur.Save(user); uDto.Key = key; uDto.EmailID = user.EmailID.ToString(); var response = request.CreateResponse(HttpStatusCode.Created, uDto); response.Headers.Location = new Uri(Url.Link("Default", new { id = user.EmailID })); return(response); }
private HttpResponseMessage ProcessNewEmailRecord(HttpRequestMessage request, EmailDTO uDto, string key, int EmailId, int userId) { var ur = new EmailRepository(); var user = new Email(); var validationErrors = GetValidationErrors(ur, user, uDto, EmailId, userId); if (validationErrors.Any()) { return ProcessValidationErrors(request, validationErrors, key); } user = ur.Save(user); uDto.Key = key; uDto.EmailID = user.EmailID.ToString(); var response = request.CreateResponse(HttpStatusCode.Created, uDto); response.Headers.Location = new Uri(Url.Link("Default", new { id = user.EmailID })); return response; }
private HttpResponseMessage ProcessExistingEmailRecord(HttpRequestMessage request, EmailDTO cqDto, int contactId, string key, int EmailId, int userId) { var ur = new EmailRepository(); var user = new Email(); user = ur.GetById(contactId); var validationErrors = GetValidationErrors(ur, user, cqDto, EmailId, userId); if (validationErrors.Any()) { return ProcessValidationErrors(request, validationErrors, key); } ur.Save(user); cqDto.Key = key; return request.CreateResponse(HttpStatusCode.Accepted, cqDto); }