public IActionResult OfferForMenu([FromQuery] string orderedmenuitems) { loggerService.LogMessage("Received at endpoint : api/OfferForMenu : UserID : " + (Request.Headers.ContainsKey("CustomerId") ? int.Parse(HttpContext.Request.Headers["CustomerId"]) : 0)); bool flag = true; var menuitems = orderedmenuitems.Replace("MenuId", "menu_ID"); var items = JsonConvert.DeserializeObject <List <RestaurantMenu> >(menuitems); foreach (var item in items) { bool status = business_Repo.Validateoffer(item.menu_ID, item.offer); if (status == false) { flag = false; } } if (flag == true) { return(Ok(items)); } else { return(this.StatusCode((int)HttpStatusCode.InternalServerError, "Offer Expired")); } }