public HttpResponseMessage GetHist(string id) { ClaimDBConnect claimDBConnect = new ClaimDBConnect(); List <Claim> claims = new List <Claim>(); var clm = from c in claimDBConnect.Claims where c.CustomerID == id select c; foreach (var cl in clm) { claims.Add(cl); } if (claims.Count > 0) { string output = JsonConvert.SerializeObject(claims); return(new HttpResponseMessage() { Content = new StringContent(output, Encoding.UTF8, "application/json"), StatusCode = HttpStatusCode.Created }); } else { return(new HttpResponseMessage() { StatusCode = HttpStatusCode.NotFound }); } }
public HttpResponseMessage GetCount(string id) { ClaimDBConnect claimDBConnect = new ClaimDBConnect(); var c = from cl in claimDBConnect.Claims where cl.CustomerID == id select cl; int number = c.Count(); string output = JsonConvert.SerializeObject(number); return(new HttpResponseMessage() { Content = new StringContent(output, Encoding.UTF8, "application/json"), StatusCode = HttpStatusCode.Created }); }
public HttpResponseMessage Post([FromBody] Claim claim) { // add claim ClaimDBConnect claimDBConnect = new ClaimDBConnect(); claimDBConnect.Claims.Add(claim); claimDBConnect.SaveChanges(); string output = JsonConvert.SerializeObject(claim); return(new HttpResponseMessage() { Content = new StringContent(output, System.Text.Encoding.UTF8, "application/json"), StatusCode = HttpStatusCode.Created }); }
public ActionResult FileClaim(Claim claim) { // nav link check if signed in if not route to signon. var check = Session["CustomerID"]; if (check == null) { return(RedirectToAction("CustomerReviewSignOn")); } if (!ModelState.IsValid) { return(View()); } // edit date ViewBag.Message = ""; DateTime valueDate; bool validDate = DateTime.TryParse(claim.DateService.ToString(), out valueDate); if (!validDate) { ViewBag.Message = "Date is not valid or Missing"; return(View()); } claim.CustomerID = Session["CustomerID"].ToString(); ClaimDBConnect claimDBConnect = new ClaimDBConnect(); claimDBConnect.Claims.Add(claim); claimDBConnect.SaveChanges(); // process file claim update. ViewBag.Message = "Claim Filed Successfully"; return(RedirectToAction("CustomerReview")); }