public IActionResult AddRestuarantTable(RestuarantTable table) { if (ModelState.IsValid) { var check = _repository.GetAllRestuarantTables().Where(q => q.TableName == table.TableName); if (check.Count() > 0) { ViewBag.AddRestuarantTable = "This Table already exists!"; } else { table.IsReserved = false; _repository.AddRestuarantTable(table); if (_repository.SaveChanges()) { ViewBag.AddRestuarantTable = "Successfull!"; ModelState.Clear(); } else { ViewBag.AddRestuarantTable = "Oops! Could not be added"; } } } return(View()); }