private HttpResponseMessage ProcessNewO2Record(HttpRequestMessage request, O2ReadingDTO uDto, string key, int companyId, int UserId) { var ur = new O2ReadingRepository(); var o2 = new O2Reading(); var validationErrors = GetO2ValidationErrors(ur, o2, uDto, companyId, UserId); if (validationErrors.Any()) { return(ProcessValidationErrors(request, validationErrors, key)); } // no validation errors... //Pond.CompanyId = companyId; o2 = ur.Save(o2); UpdatePondHealthStatusByLevel(o2.PondId, o2.O2Level); uDto.Key = key; uDto.ReadingId = o2.ReadingId.ToString(); var response = request.CreateResponse(HttpStatusCode.Created, uDto); response.Headers.Location = new Uri(Url.Link("Default", new { id = o2.ReadingId })); return(response); }
private HttpResponseMessage ProcessExistingO2Record(HttpRequestMessage request, O2ReadingDTO cqDto, int contactId, string key, int companyId, int UserId) { var o2r = new O2ReadingRepository(); var o2 = new O2Reading(); o2 = o2r.GetById(contactId); // is the Pond eligible to update the prospect? var validationErrors = GetO2ValidationErrors(o2r, o2, cqDto, companyId, UserId); if (validationErrors.Any()) { return(ProcessValidationErrors(request, validationErrors, key)); } // no validation errors... o2r.Save(o2); UpdatePondHealthStatusByLevel(o2.PondId, o2.O2Level); cqDto.Key = key; return(request.CreateResponse(HttpStatusCode.Accepted, cqDto)); }
private HttpResponseMessage ProcessNewO2Record(HttpRequestMessage request, O2ReadingDTO uDto, string key, int companyId, int UserId) { var ur = new O2ReadingRepository(); var o2 = new O2Reading(); var validationErrors = GetO2ValidationErrors(ur, o2, uDto, companyId, UserId); if (validationErrors.Any()) { return ProcessValidationErrors(request, validationErrors, key); } // no validation errors... //Pond.CompanyId = companyId; o2 = ur.Save(o2); UpdatePondHealthStatusByLevel(o2.PondId, o2.O2Level); uDto.Key = key; uDto.ReadingId = o2.ReadingId.ToString(); var response = request.CreateResponse(HttpStatusCode.Created, uDto); response.Headers.Location = new Uri(Url.Link("Default", new { id = o2.ReadingId })); return response; }
private HttpResponseMessage ProcessExistingO2Record(HttpRequestMessage request, O2ReadingDTO cqDto, int contactId, string key, int companyId, int UserId) { var o2r = new O2ReadingRepository(); var o2 = new O2Reading(); o2 = o2r.GetById(contactId); // is the Pond eligible to update the prospect? var validationErrors = GetO2ValidationErrors(o2r, o2, cqDto, companyId, UserId); if (validationErrors.Any()) { return ProcessValidationErrors(request, validationErrors, key); } // no validation errors... o2r.Save(o2); UpdatePondHealthStatusByLevel(o2.PondId, o2.O2Level); cqDto.Key = key; return request.CreateResponse(HttpStatusCode.Accepted, cqDto); }