public async Task <ActionResult> NotRegisteredOrder(NotRegisteredOrderViewModel model) { if (!ModelState.IsValid) { @ViewBag.OrderContainer = model.OrdersStringJSON; return(View()); } if (model.OrdersStringJSON == null) { ModelState.AddModelError("", "Error, empty Local Storage!"); return(View(model)); } else { var orderContainer = new OrderContainer { DateTime = DateTime.Now, IsAccepted = false, NotRegisteredUser = true, Phone = model.Phone }; try { JavaScriptSerializer js = new JavaScriptSerializer(); ICollection <Order> orders = js.Deserialize <ICollection <Order> >(model.OrdersStringJSON); orderContainer.Order = orders; } catch (Exception) { ModelState.AddModelError("", "Local Storage error!"); return(View(model)); } await _roomService.AddOrderContainerAsync(orderContainer); return(RedirectToAction("Index")); } }