public async Task <IActionResult> NewTable(IFormCollection form) { if (ModelState.IsValid) { var user = HttpContext.Session.Get <User>(Constants.SessionKeyState); int rolId = user.Role.Id; string userId = user.Id; string establishmentId = user.Establishment.id; Table table = new Table() { establishmentId = establishmentId, userId = userId, Location = form["location"], Logo = "../assets/images/table/mesa.jpg", Quantity = Convert.ToInt32(form["quantity"]), SelectType = form["selectType"], MinimumConsumption = Convert.ToDouble(form["minimumConsumption"]), SmokingArea = !string.IsNullOrEmpty(form["smokingArea"]) ? true : false, Vacant = true }; var result = _tableAgent.CreateTable(table); if (result.Success) { return(await Task.FromResult(RedirectToAction("Index", "Table"))); } } return(await Task.FromResult(View())); }