public Restaurant ToDomainModel() { var entity = new Restaurant { RestaurantName = RestaurantName, RestaurantTypeId = RestaurantTypeId, PreferredDayOfWeek = PreferredDayOfWeek }; return entity; }
public void RestaurantCanCalculateCapacity() { Restaurant joes = new Restaurant(); joes.Numberof4PersonTables = 8; joes.Numberof2PersonTables = 6; Assert.AreEqual(44, joes.capacity()); }
public void RestaurantCanAddToCurrentCustomerAnotherWay() { Restaurant joes = new Restaurant(); Customer Steve = new Customer(); joes.AddCustomerToList(Steve); CollectionAssert.Contains(joes.CurrentCustomers, Steve); }
public IHttpActionResult CreateRestaurant(RestaurantModels.RestaurantInputModel restaurantModel) { if (!this.ModelState.IsValid) { return this.BadRequest(this.ModelState); } if (!this.User.Identity.IsAuthenticated) { return this.Unauthorized(); } Restaurant newRestaurant = new Restaurant { Name = restaurantModel.name, OwnerId = HttpContext.Current.User.Identity.GetUserId(), TownId = restaurantModel.townId }; this.Data.Restaurants.Add(newRestaurant); this.Data.SaveChanges(); var outputData = this.Data.Restaurants.All().Where(x => x.Id == newRestaurant.Id).Select(RestaurantModels.RestaurantOutputModel.Parse); return this.Created(Location + newRestaurant.Id, outputData); }
/// <summary> /// Retrieves and instance of the restaurant with the specified id. /// </summary> /// <param name="restaurantId">The id of the restaurant to retrieve.</param> /// <returns>An instance of a restaurant with the given id.</returns> public static Restaurant GetRestaurant(long restaurantId) { Restaurant restaurant = null; using (SqlConnection con = new SqlConnection(ConfigurationManager.ConnectionStrings["RestaurantReviews"].ConnectionString)) { con.Open(); using (SqlCommand com = new SqlCommand("GetRestaurant", con)) { com.CommandType = CommandType.StoredProcedure; com.Parameters.Add(new SqlParameter { ParameterName = "@restaurantid", SqlDbType = SqlDbType.BigInt, Value = restaurantId }); using (SqlDataReader reader = com.ExecuteReader()) { if (!reader.HasRows) throw (new RetrievalException($"Failed to retrieve restaurant instance, ID={restaurantId}.")); reader.Read(); restaurant = new Restaurant(); restaurant.Id = (long)reader["id"]; restaurant.Name = (string)reader["name"]; reader.Close(); } } con.Close(); } return restaurant; }
public void CustomerIsReadyToOrder() { Customer Bob = new Customer(); Restaurant joes = new Restaurant(); MenuItem coke = new MenuItem(); coke.Name = "coke"; MenuItem lasagna = new MenuItem(); lasagna.Name = "lasagna"; MenuItem milkshake = new MenuItem(); milkshake.Name = "milkshake"; joes.MenuItems.Add(coke); joes.MenuItems.Add(lasagna); joes.MenuItems.Add(milkshake); //The object initializer syntax used for bobsOrder is a shortcut used to set properties on an object when creating it Order bobsOrder = new Order { Drink = "coke", Entree = "lasagna", Dessert = "milkshake" }; Assert.IsTrue(bobsOrder.VerifyOrderComplete()); Assert.IsTrue(Bob.ReadyToPlaceOrder(bobsOrder, joes)); }
public static NSUserActivity CreateNSUserActivity(Restaurant userInfo) { var activityType = ActivityTypes.View; var activity = new NSUserActivity(activityType); activity.EligibleForSearch = true; // HACK: can result in duplicates with CoreSpotlight activity.EligibleForPublicIndexing = false; activity.EligibleForHandoff = false; activity.Title = "Restaurant " + userInfo.Name; // var keywords = new NSString[] {new NSString("Add"), new NSString("Todo"), new NSString("Empty"), new NSString("Task") }; // activity.Keywords = new NSSet<NSString>(keywords); var attributeSet = new CoreSpotlight.CSSearchableItemAttributeSet (); attributeSet.DisplayName = userInfo.Name; attributeSet.ContentDescription = userInfo.Cuisine + " " + userInfo.Chef; // Handoff https://developer.apple.com/library/ios/documentation/UserExperience/Conceptual/Handoff/AdoptingHandoff/AdoptingHandoff.html // attributeSet.RelatedUniqueIdentifier = userInfo.Number.ToString(); // CoreSpotlight "id" activity.AddUserInfoEntries(NSDictionary.FromObjectAndKey(new NSString(userInfo.Number.ToString()), ActivityKeys.Id)); activity.ContentAttributeSet = attributeSet; activity.BecomeCurrent (); // don't forget to ResignCurrent() return activity; }
/// <summary> /// Validates that a restaurant instance has the necessary information before persisting. /// </summary> /// <param name="member"></param> private static void ValidateRestaurant(Restaurant restaurant) { if (string.IsNullOrWhiteSpace(restaurant.Name)) throw (new System.ArgumentException("Restaurant name cannot be null or whitespace.")); else if (restaurant.Name.Length > 100) throw (new System.ArgumentException("Restaurant name exceeds maximum length of 100 characters.")); }
public static Restaurant CreateRestaurant(int userId, string name, string food, string restaurantType, int size, string city, string opening, string meals, string drinks) { Restaurant restaurant = new Restaurant(); restaurant.UserId = userId; restaurant.Name = name; restaurant.Food = food; restaurant.RestaurantType = restaurantType; restaurant.Size = size; restaurant.SquareFootage = size * 15; restaurant.City = city; restaurant.Opening = opening; restaurant.Save(); Answer.CreateAnswersFromTemplate(restaurant, meals, drinks); Users user = Users.LoadById(restaurant.UserId); if (ConfigurationManager.AppSettings["IsProduction"] == "true") { string body = string.Format("{0}<br>UserId: {1}<br>Name: {2}<br>Email: {3}", restaurant.Name, user.Id, user.Name, user.Email); Email email = new Email("*****@*****.**", "*****@*****.**", "New Restaurant", body); email.Send(); } HttpContext.Current.Session["CurrentUser"] = user; HttpContext.Current.Session["CurrentProspect"] = null; return restaurant; }
private void AssertRestaurantIsCorrect(Restaurant expectedRestaurant, Restaurant restaurant) { Assert.AreEqual(expectedRestaurant.Name, restaurant.Name); Assert.AreEqual(expectedRestaurant.RatingStars, restaurant.RatingStars); Assert.AreEqual(expectedRestaurant.NumberOfRatings, restaurant.NumberOfRatings); Assert.AreEqual(expectedRestaurant.CuisineTypes.Count, restaurant.CuisineTypes.Count); Assert.AreEqual(expectedRestaurant.CuisineTypes[0].Name, restaurant.CuisineTypes[0].Name); }
public void Start(Restaurant restaurant) { var w = RestaurantGuide.iOS.AppDelegate.Current.window; Console.WriteLine ($" UserActivity.BecomeCurrent ({restaurant.Name})"); w.UserActivity = UserActivityHelper.CreateNSUserActivity (restaurant); // HACK: not sure why, this awful/unnecessary hack call seems to force the userInfo to be preserved for AppDelegate.ContinueUserActivity w.UpdateUserActivityState (UserActivityHelper.CreateNSUserActivity (restaurant)); // end hack https://forums.developer.apple.com/thread/9690 }
public Restaurant Delete(Restaurant entity) { using (_connection = Utilities.GetProfiledOpenConnection()) { _connection.Delete(entity); } return entity; }
/// <summary> /// Creates a restaurant instance. /// </summary> /// <param name="name">The name of the restaurant.</param> /// <returns>A restaurant instance.</returns> public static Restaurant CreateRestaurant(string name) { Restaurant restaurant = new Restaurant { Name = name }; CreateRestaurant(restaurant); return restaurant; }
public void RestaurantCanCheckIfAnItemIsOnMenuWhenGivenString() { Restaurant joes = new Restaurant(); MenuItem flavorsOfFried = new MenuItem(); flavorsOfFried.Name = "Sampler Platter"; joes.MenuItems.Add(flavorsOfFried); Assert.IsTrue(joes.ItemIsOnMenu("Sampler Platter")); }
public Bringo() { Restaurant r = new Restaurant(); r.id = 1; r.name = "Токио Хоум"; r.Address = "000000, г Владивосток, проспект 100 лет Владивостоку, д 50А"; r.phone = "+74232707707"; rests.Add(r); r = new Restaurant(); r.id = 1002128; r.name = "Токио (ост. Гайдамак)"; r.Address = "000000, г Владивосток, ул Светланская, 183В"; r.phone = "+74232750750"; rests.Add(r); r = new Restaurant(); r.id = 1002257; r.name = "Токио Kawaii"; r.Address = "000000, г Владивосток, ул Семеновская, 7В"; r.phone = "+74232447777"; rests.Add(r); r = new Restaurant(); r.id = 1003172; r.name = "Токио (Первая речка)"; r.Address = "000000, г Владивосток, проспект Острякова, 8"; r.phone = "+74232227777"; rests.Add(r); r = new Restaurant(); r.id = 1005896; r.name = "Токио в г. Уссурийск"; r.Address = "000000, г Уссурийск, ул Комсомольская, 28"; r.phone = "+74234346464"; rests.Add(r); r = new Restaurant(); r.id = 1008008; r.name = "Токио (ост. Дальзавод)"; r.Address = "000000, г Владивосток, ул Светланская, 121"; r.phone = "+74232367777"; rests.Add(r); r = new Restaurant(); r.id = 1009190; r.name = "Токио в г. Находка"; r.Address = "000000, г Находка, проспект Мира, 2"; r.phone = "+74236617777"; rests.Add(r); serviceUrl = WebConfigurationManager.AppSettings["ServiceURL"].ToString(); connectionString = WebConfigurationManager.ConnectionStrings["DLVConnectionString"].ToString(); Login = WebConfigurationManager.AppSettings["BringoLogin"].ToString(); Password = WebConfigurationManager.AppSettings["BringoPassword"].ToString(); GMTtimeShift = Convert.ToInt32(WebConfigurationManager.AppSettings["GMTtimeShift"]); RestIDs = WebConfigurationManager.AppSettings["RestIDs"].ToString(); }
/// <summary> /// Updates a restaurant instance. /// </summary> /// <param name="restaurant">The restaurant to persist.</param> public static void UpdateRestaurant(Restaurant restaurant) { if (restaurant.Id == -1) throw (new System.ArgumentException("Restaurant is new instance and needs to be saved before updating.")); ValidateRestaurant(restaurant); Data.RestaurantSQL.UpdateRestaurant(restaurant); }
/// <summary> /// Persist a new restaurant instance. /// </summary> /// <param name="restaurant">The restaurant to persist.</param> public static void CreateRestaurant(Restaurant restaurant) { if (restaurant.Id != -1) throw (new System.ArgumentException("Restaurant is not a new instance.")); ValidateRestaurant(restaurant); Data.RestaurantSQL.CreateRestaurant(restaurant); }
/// <summary> /// Updates a restaurant instance. /// </summary> /// <param name="restaurantId">The id of the restaurant to persist.</param> /// <param name="name">The name of the restaurant.</param> /// <returns>An instance of the updated restaurant.</returns> public static Restaurant UpdateRestaurant(long restaurantId, string name) { Restaurant restaurant = new Restaurant(); restaurant.Id = restaurantId; restaurant.Name = name; UpdateRestaurant(restaurant); return restaurant; }
private static void WriteResults(FileInfo file, List<Restaurant> choices, Restaurant chosenRestaurant) { StreamWriter streamWriter = new StreamWriter(file.FullName); foreach (Restaurant choice in choices) { streamWriter.WriteLine(choice.Name + (choice == chosenRestaurant ? "*" : "")); } streamWriter.Flush(); streamWriter.Close(); }
public static Menu CreateMenu(Restaurant r, int week, int year, string info) { var m = new Menu() {Week = week, Year = year, Info = info}; using(var db = new DataContext()) { m.Restaurant = db.Restaurants.Find(r.Id); db.Menus.Add(m); db.SaveChanges(); } return m; }
public static string CreateUser(Users user, string restaurantName) { try { user.Joined = DateTime.Now; user.Save(); Restaurant restaurant = new Restaurant() { Name = restaurantName, UserId = user.Id }; restaurant.Save(); HttpContext.Current.Session["CurrentUser"] = user; if (ConfigurationManager.AppSettings["IsProduction"] == "true") { //string body = "New Sign Up"; //body += string.Format("<br/>Name: {0}<br/>Email: {1}", user.Name, user.Email); ////Email email1 = new Email("*****@*****.**", "*****@*****.**", "New Sign Up", body); ////email1.Send(); //Email email2 = new Email("*****@*****.**", "*****@*****.**", "New Sign Up", body); //email2.Send(); } } catch (Exception ex) { ////Email email1 = new Email("*****@*****.**", "*****@*****.**", "Sign Up Error", ex.Message); ////email1.Send(); //Email email2 = new Email("*****@*****.**", "*****@*****.**", "Sign Up Error", ex.Message); //email2.Send(); } return ""; //string error = BuyPlan(user); //if(string.IsNullOrEmpty(error)) //{ // user.Joined = DateTime.Now; // user.Save(); // Restaurant restaurant = new Restaurant() { Name = restaurantName, UserId = user.Id }; // restaurant.Save(); // HttpContext.Current.Session["CurrentUser"] = user; // if (ConfigurationManager.AppSettings["IsProduction"] == "true") // { // string body = user.Annual ? "Purchase: Annual" : "Purchase: Monthly"; // body += string.Format("<br/>Name: {0}<br/>Email: {1}", user.Name, user.Email); // //Email email1 = new Email("*****@*****.**", "*****@*****.**", "New Purchase", body); // //email1.Send(); // Email email2 = new Email("*****@*****.**", "*****@*****.**", "New Purchase", body); // email2.Send(); // } // return ""; //} //return error; }
public int RestaurantAdd(int cityid, string name) { RestaurantService r = new RestaurantService(); Restaurant model = new Restaurant(); model.CityID = cityid; model.Name = name; return r.Add(model, 0); }
static void Main() { Restaurant rOne = new Restaurant("Italinos MeatBall House", true, false, true); Restaurant rTwo = new Restaurant("Momma Sass's Kitchen", false, true, false); Restaurant rThree = new Restaurant("Sloppy Icecream Sundays", true, true, true); Restaurant rFour = new Restaurant("Bob's Burgers", false, false, false); List<Restaurant> newRestaurant = new List<Restaurant>() {rOne, rTwo, rThree, rFour}; foreach (Restaurant rTypes in newRestaurant) { Console.WriteLine("Restaurant: " + rTypes.name + "\n" + "Is it Vegan Free: " + rTypes.vegan + "\nIs it Peanut-Free: " + rTypes.peanutfree + "\nIs it organic: " + rTypes.organic + "\n\n"); } }
public static long CreateRestaurant(Restaurant r, List<long> areaIds) { using (var db = new DataContext()) { r.Company = db.Companies.Find(r.Company.Id); db.Restaurants.Add(r); foreach (var id in areaIds) { r.Areas.Add(db.LunchAreas.Find(id)); } db.SaveChanges(); } return r.Id; }
public static void Main() { Restaurant firstRestaurant = new Restaurant("bobs diner", false, false, false); Restaurant secondRestaurant = new Restaurant("joes diner", true, true, true); Restaurant thirdRestaurant = new Restaurant("bills diner", false, false, false); List<Restaurant> restaurants = new List<Restaurant>() { firstRestaurant, secondRestaurant, thirdRestaurant }; foreach (Restaurant restaurant in restaurants) { Console.WriteLine(restaurant.Name); Console.WriteLine("Vegan? " + restaurant.Vegan); Console.WriteLine("PeanutFree? " + restaurant.PeanutFree); Console.WriteLine("Organic? " + restaurant.Organic); } }
public static long CreateCompany(CompanyCreateModel createModel) { var db = new DataContext(); var c = new Company(createModel.IsRestaurant) { Name = createModel.CompanyName, Organisationnr = createModel.Organisationnr, Information = createModel.Information, Notes = createModel.Notes, Latitude = createModel.Latitude, Longitude = createModel.Longitude, EniroId = createModel.EniroId, Email = createModel.Email, Url = createModel.Url, //PhoneNumbers = model.PhoneNumbers.Select(p => new PhoneNumber { // Number = p.Number, // Type = (PhoneNumberType) p.Type // }).ToList(), Adress = new Adress { PostCode = createModel.PostCode, Street = createModel.Street, PostArea = createModel.PostArea } }; try { db.Companies.Add(c); //c.Adress.City = db.Cities.Find(c.Adress.City.Id); if (createModel.IsRestaurant) { var r = new Restaurant(); var area = db.LunchAreas.Find(createModel.LunchAreaId); r.SetDataFromCompany(c, area); r.Areas.Add(area); db.Restaurants.Add(r); } db.SaveChanges(); return c.Id; } catch (Exception ex) { throw new Exception(); } }
/// <summary> /// Updates a previously created restaurant instance. /// </summary> /// <param name="restaurant">The restaraunt instance to update.</param> public static void UpdateRestaurant(Restaurant restaurant) { using (SqlConnection con = new SqlConnection(ConfigurationManager.ConnectionStrings["RestaurantReviews"].ConnectionString)) { con.Open(); using (SqlCommand com = new SqlCommand("UpdateRestaurant", con)) { com.CommandType = CommandType.StoredProcedure; com.Parameters.Add(new SqlParameter { ParameterName = "@restaurantid", SqlDbType = SqlDbType.BigInt, Value = restaurant.Id }); com.Parameters.Add(new SqlParameter { ParameterName = "@name", SqlDbType = SqlDbType.NVarChar, Value = restaurant.Name }); if (com.ExecuteNonQuery() != 1) throw (new PersistanceException($"Failed to update restaurant, ID={restaurant.Id}.")); } con.Close(); } }
public ActionResult Edit(int id, Restaurant restaurant) { try { if (ModelState.IsValid) { _db.Entry(restaurant).State = EntityState.Modified; _db.SaveChanges(); return RedirectToAction("Index"); } return View(restaurant); } catch { return View("Error"); } }
public Restaurant SaveOrUpdate(Restaurant entity) { using (_connection = Utilities.GetProfiledOpenConnection()) { if (entity.Id > 0) { _connection.Update(entity); } else { var insert = _connection.Insert(entity); entity.Id = insert; } return entity; } }
public Restaurant Update(Restaurant restaurant) { _context.Attach(restaurant).State = Microsoft.EntityFrameworkCore.EntityState.Modified; _context.SaveChanges(); return(restaurant); }
public void Add(Restaurant restaurant) { restaurants.Add(restaurant); restaurant.Id = restaurants.Max(r => r.Id) + 1; }
public int AddRestaurant(Restaurant restaurant) { return(restaurantRepository.AddRestaurant(restaurant)); }
protected override void OnNavigatedTo(NavigationEventArgs e) { _restaurant = e.Parameter as Restaurant; DownloadRestaurantComments(); }
public void updateRestaurantById(Restaurant res) { restaurantBroker.updateRestaurantInfo(res); }
public async Task <IHttpActionResult> GetByID(int id) { Restaurant restaurant = await _context.Restaurant.FindAsync(id); return(Ok()); }
void Start() { restaurant = transform.parent.GetComponentInParent <Restaurant> (); }
public void Save(Restaurant rest) { _event_Restaurant.Save(rest); }
private Task GetGoogleData(string keyWord, City city, string type) { return(Task.Run(() => { string data = string.Empty; string url = @"https://maps.googleapis.com/maps/api/place/nearbysearch/json?key=" + ApiKey.mapsKey + @"&location=" + city.Latitude + @"," + city.Longitude + @"&keyword=" + keyWord + @"&type=" + type.ToLower() + "&radius=5000"; HttpWebRequest request = (HttpWebRequest)WebRequest.Create(url); request.AutomaticDecompression = DecompressionMethods.GZip; using (HttpWebResponse response = (HttpWebResponse)request.GetResponse()) using (Stream stream = response.GetResponseStream()) using (StreamReader reader = new StreamReader(stream)) { data = reader.ReadToEnd(); } JObject returnData = JObject.Parse(data); List <JObject> returnList = new List <JObject>(); foreach (JObject j in returnData["results"]) { if (type == "Bar") { Bar newBar = new Bar(); lock (thisLock) { newBar.CategoryId = _context.Categories.Where(c => c.CategoryType == keyWord).Where(c => c.CategoryName == type).Select(c => c.Id).Single(); newBar.Category = _context.Categories.Where(c => c.Id == newBar.CategoryId).Single(); newBar.CityId = _context.Cities.Where(c => c.CityName == city.CityName).Select(c => c.Id).Single(); newBar.City = _context.Cities.Where(c => c.Id == newBar.CityId).Single(); } newBar.Latitude = Convert.ToDouble(j["geometry"]["location"]["lat"]); newBar.Longitude = Convert.ToDouble(j["geometry"]["location"]["lng"]); newBar.Likes = 0; newBar.Dislikes = 0; newBar.Name = j["name"].ToString(); try { newBar.CardPhoto = j["photos"][0]["photo_reference"].ToString(); } catch { newBar.CardPhoto = null; } Bar foundMatchingBar; lock (thisLock) { foundMatchingBar = _context.Bars.Where(r => r.Latitude == newBar.Latitude).Where(r => r.Longitude == newBar.Longitude).Where(r => r.Name == newBar.Name).FirstOrDefault(); } if (foundMatchingBar == null) { lock (thisLock) { _context.Bars.Add(newBar); } } } else if (type == "Restaurant") { Restaurant newRestaurant = new Restaurant(); lock (thisLock) { newRestaurant.CategoryId = _context.Categories.Where(c => c.CategoryType == keyWord).Where(c => c.CategoryName == type).Select(c => c.Id).Single(); newRestaurant.Category = _context.Categories.Where(c => c.Id == newRestaurant.CategoryId).Single(); newRestaurant.CityId = _context.Cities.Where(c => c.CityName == city.CityName).Select(c => c.Id).Single(); newRestaurant.City = _context.Cities.Where(c => c.Id == newRestaurant.CityId).Single(); } newRestaurant.Latitude = Convert.ToDouble(j["geometry"]["location"]["lat"]); newRestaurant.Longitude = Convert.ToDouble(j["geometry"]["location"]["lng"]); newRestaurant.Likes = 0; newRestaurant.Dislikes = 0; newRestaurant.Name = j["name"].ToString(); try { newRestaurant.CardPhoto = j["photos"][0]["photo_reference"].ToString(); } catch { newRestaurant.CardPhoto = null; } Restaurant foundMatchingRestaurant; lock (thisLock) { foundMatchingRestaurant = _context.Restaurants.Where(r => r.Latitude == newRestaurant.Latitude).Where(r => r.Longitude == newRestaurant.Longitude).Where(r => r.Name == newRestaurant.Name).FirstOrDefault(); } if (foundMatchingRestaurant == null) { lock (thisLock) { _context.Restaurants.Add(newRestaurant); } } } else { throw new ArgumentException("Must be searching either a bar or restaurant."); } lock (thisLock) { _context.SaveChanges(); } } })); }
public Restaurant Add(Restaurant newRestaurant) { restaurants.Add(newRestaurant); newRestaurant.Id = restaurants.Max(r => r.Id) + 1; return(newRestaurant); }
public ActionResult UpdateRestaurantForm(int id) { Restaurant newRestaurant = Restaurant.Find(id); return(View(newRestaurant)); }
public void EditRestaurant(Restaurant restaurant) { restaurantRepository.EditRestaurant(restaurant); }
public ActionResult Index() { List <Restaurant> allRestaurants = Restaurant.GetAll(); return(View(allRestaurants)); }
public Restaurant Add(Restaurant restaurant) { _context.Restaurants.Add(restaurant); _context.SaveChanges(); return(restaurant); }
public Restaurant Add(Restaurant newRestaurant) { db.Add(newRestaurant); return(newRestaurant); }
public ActionResult DeleteAll() { Restaurant.DeleteAll(); return(RedirectToAction("Index")); }
public void deleteResturantById(Restaurant res) { restaurantBroker.DeleteRestaurant(res); }
public ActionResult Details(int id) { Restaurant thisRestaurant = _db.Restaurants.FirstOrDefault(restaurant => restaurant.RestaurantId == id); return(View(thisRestaurant)); }
public void addRestaurant(Restaurant r) { restaurantBroker.addNewRestaurant(r); }
public async Task UpdateAsync(Restaurant restaurant) { using var ctx = new RestaurantContext(); ctx.Entry(restaurant).State = EntityState.Modified; await ctx.SaveChangesAsync(); }
public async Task DeleteAsync(Restaurant restaurant) { restaurant.IsDeleted = true; await UpdateAsync(restaurant); }
public Restaurant Add(Restaurant createdRestaurant) { dbContext.Restaurants.Add(createdRestaurant); return(createdRestaurant); }
public void Delete(Restaurant restaurant) { restaurant.IsDeleted = true; Update(restaurant); }
public void Dispose() { Cuisine.ClearAll(); Restaurant.ClearAll(); }
public Restaurant Add(Restaurant restaurant) { restaurant.Id = restaurants.Max(r => r.Id) + 1; restaurants.Add(restaurant); return(restaurant); }
public ActionResult Create(Restaurant restaurant) { _db.Restaurants.Add(restaurant); _db.SaveChanges(); return(RedirectToAction("Index")); }
public void OnGet(int restaurantId) { Restaurant = new Restaurant(); }
public ActionResult Edit(Restaurant restaurant) { _db.Entry(restaurant).State = EntityState.Modified; _db.SaveChanges(); return(RedirectToAction("Index")); }
public ActionResult ShowRestaurant(int id) { Restaurant newRestaurant = Restaurant.Find(id); return(View(newRestaurant)); }
public Restaurant Update(Restaurant restaurant) { throw new NotImplementedException(); }
private void AddEditRestaurant_Load(object sender, EventArgs e) { if(RestaurantID!=null) { var unitOfWork = new UnitOfWork(); Restaurant = unitOfWork.RestaurantRepository.Get(x => x.Id == RestaurantID).FirstOrDefault(); tbLocation.Text = Restaurant.Location; tbName.Text = Restaurant.Name; tbCapacity.Value = Restaurant.Capacity; } }