public static void Main() { Chef chef = new Chef(); Potato potato = new Potato(); potato.IsRotten = false; if (potato != null) { // Potato will be peeled during Cook process, so this check is not necessary if (!potato.IsRotten) { chef.Cook(potato); Console.WriteLine("Potato is cooked!"); } else { throw new ArgumentOutOfRangeException("Cannot cook rotten potato!"); } } else { throw new ArgumentNullException("There is no potato!"); } }
/// <summary> /// The entry point of the application. /// </summary> private static void Main() { Chef theDev = new Chef(); theDev.MakeSoup(); Console.WriteLine(theDev.Log); }
public static void Main(string[] args) { // First Task: Potato potato = new Potato(); // ... if (potato == null) { throw new ArgumentNullException(); } var me = new Chef("Ivan"); var ingredients = new List<Vegetable>(); ingredients.Add(potato); if (potato.IsPeeled && !potato.IsRotten) { me.CookVegitables(ingredients, new Bowl()); } // Second Task: const int MIN_X = -100; const int MAX_X = 100; const int MIN_Y = -50; const int MAX_Y = 50; int x = 0; int y = 0; bool shouldVisitCell = true; bool inRangeX = MIN_X <= x && x <= MAX_X; bool inRangeY = MIN_Y <= y && y <= MAX_Y; if (inRangeX && inRangeY && shouldVisitCell) { VisitCell(x, y); } }
public static void Main() { Chef chef = new Chef(); Potato potato = new Potato(); if (potato == null) { throw new ArgumentNullException("Potato should be created."); } else if (potato.IsPeeled && potato.IsRotten) { chef.Cook(potato); } }
public IActionResult AddChefToDB(Chef chefToAdd) { // If validation errors, send back to form if (ModelState.IsValid == false) { return(View("AddChef")); } chefToAdd.CreatedAt = DateTime.Now; chefToAdd.UpdatedAt = DateTime.Now; db.Add(chefToAdd); db.SaveChanges(); return(RedirectToAction("Index")); }
public IActionResult CreateChef(Chef newChef) { if (ModelState.IsValid) { _context.Add(newChef); _context.SaveChanges(); return(RedirectToAction("Index")); } else { return(View("New")); } }
public static Bowl ProcessVegetable(Vegetable vegetable, Chef chef) { bool isCookable = IsCookable(vegetable); if (isCookable) { return(chef.Cook(vegetable)); } else { throw new ArgumentException("The vegetable must be peeled and not rotten in order to be cooked."); } }
public IActionResult Create(Chef newChef) { if (ModelState.IsValid == false) { return(View("New")); //Just "New" - already in Chef } // ModalState.IsValid... // newDish.CreatedAt = DateTime.Now; //works, but moved to Model's instantiation db.Chefs.Add(newChef); //DB Insert db.SaveChanges(); return(RedirectToAction("Index")); // return RedirectToAction("Details", newDish.DishId); //"Details", new {id = newDish.DishId} }
/// <summary> /// /// </summary> private void ResearchTreeSaveSate(Save_State save) { for (int i = 0; i < Chef_Requirment_Purchasable.Count; i++) { Chef chef = Chef_Requirment_Purchasable[i]; Chef_Research_Save_State save_state = new Chef_Research_Save_State(); save_state.Name = chef.Name; save_state.Unlocked = chef.Unlocked; save_state.Current_Level = chef.CurrentLevel; save.Chef_Research_Save_State.Add(save_state); } }
public static Chef_data FromDomain(Chef chef) { return(new Chef_data { firstname = chef.Firstname, lastname = chef.Lastname, age = chef.Age, email = chef.Email, mobile = chef.Mobile, residentialaddress = chef.Residentialaddress, idnumber = chef.Idnumber, }); }
public IActionResult AddChef(Chef newChef) { if (ModelState.IsValid) { dbContext.Chefs.Add(newChef); dbContext.SaveChanges(); return(RedirectToAction("Index")); } else { return(View("NewChef")); } }
public IActionResult ChefCreator(Chef yourSurvey) { if (ModelState.IsValid) { dbContext.Add(yourSurvey); dbContext.SaveChanges(); return(RedirectToAction("Index")); } else { return(View("New")); } }
public IActionResult AddNewChef(Chef newChef) { var ageCheck = DateTime.Now.Year - newChef.Birthday.Year; if (ageCheck < 18) { ModelState.AddModelError("Birthday", "Must be at least 18 years old"); return(View("NewChef")); } dbContext.Add(newChef); dbContext.SaveChanges(); return(RedirectToAction("Index")); }
public IActionResult AddChef(Chef chef) { if (ModelState.IsValid) { dbContext.Add(chef); dbContext.SaveChanges(); return(RedirectToAction("Index")); } else { return(View("ChefAddForm")); } }
public IActionResult New(Chef thisChef) { if (ModelState.IsValid) { dbContext.Add(thisChef); dbContext.SaveChanges(); return(RedirectToAction("Index")); } else { return(View("New", thisChef)); } }
public IActionResult AddChef(Chef newChef) { if (ModelState.IsValid) { dbContext.AddChef(newChef); } else { return(View("NewChef")); } // return RedirectToAction("Index"); return(Redirect("/")); }
public IActionResult CreateDish(Dish newDish, int creatorId) { Chef creator = dbContext.Chefs.FirstOrDefault(chef => chef.ChefId == creatorId); newDish.Creator = creator; if (ModelState.IsValid) { dbContext.Add(newDish); dbContext.SaveChanges(); return(RedirectToAction("DishesView")); } return(View("NewDish")); }
public IActionResult CreateChef(Chef newchef) { if (ModelState.IsValid) { db.Add(newchef); db.SaveChanges(); return(RedirectToAction("Index", newchef)); } else { return(RedirectToAction("NewChef")); } }
[Test] public void TestInsert() { Chef chef = new Chef(); chef.FirstName = "Gil"; chef.LastName = "shinar"; Db.Insert(chef); Chef chef2 = Db.Get <Chef>(chef.Id); Assert.AreEqual(chef, chef2); }
private void Form1_Load(object sender, EventArgs e) { var restaurante = new Restaurante(); var chef1 = new Chef(); restaurante.SacarPlato(chef1); restaurante.SacarPlato(chef1); var repostero1 = new Repostero(); restaurante.SacarPlato(repostero1); MessageBox.Show($"El total es {restaurante.CostoTotal}"); }
public static void Main() { Potato potato = new Potato(); if (potato != null) { if (!(potato.HasNotBeenPeeled || potato.IsRotten)) { Chef masterChef = new Chef(); masterChef.Cook(potato); } } }
public IActionResult AddChefForm(Chef FromForm) { if (ModelState.IsValid) { dbContext.Chefs.Add(FromForm); dbContext.SaveChanges(); return(RedirectToAction("DisplayChefs")); } else { return(View("AddChefPage", FromForm)); } }
public IActionResult CreateChef(Chef NewChef) { if (ModelState.IsValid) { dbContext.Add(NewChef); dbContext.SaveChanges(); return(RedirectToAction("NewChef")); } else { return(View("NewChef")); } }
public IActionResult ProcessChef(Chef newbie) { if (ModelState.IsValid) { dbContext.Chefs.Add(newbie); dbContext.SaveChanges(); return(Redirect("/")); } else { return(View("AddChef")); } }
public IActionResult processchef(Chef submitted_chef) { if (ModelState.IsValid) { dbContext.Add(submitted_chef); dbContext.SaveChanges(); return(RedirectToAction("Index")); } else { return(View("NewChef")); } }
public IActionResult CreateChef(Chef FromForm) { if (ModelState.IsValid) { dbContext.Add(FromForm); dbContext.SaveChanges(); return(RedirectToAction("Index")); } else { return(View("addChef")); } }
public IActionResult CreateChef(Chef newChef) { if (ModelState.IsValid) { _context.Chefs.Add(newChef); _context.SaveChanges(); return(Redirect("/")); } else { return(View("AddChef")); } }
private void new_user_button_Click(object sender, EventArgs e) { if (this.doublicate.Text != this.password_field.Text) { MessageBox.Show("Пароль введен с ошибкой"); login_field.Text = ""; password_field.Text = ""; doublicate.Text = ""; } else { string result = users.Check(login_field.Text, password_field.Text); if (result == "adm" || result == "che" || result == "Wrong_pas") { MessageBox.Show("Пользователь уже существует"); login_field.Text = ""; password_field.Text = ""; doublicate.Text = ""; } else { if (status.SelectedIndex == 1) { Admin admin = new Admin(login_field.Text, password_field.Text); users.Admins.Add(admin); MessageBox.Show("Пользователь успешно добавлен"); users.Save(); this.Close(); Main_admin main_adm = new Main_admin(); main_adm.Show(); } else { if (status.SelectedIndex == 0) { Chef chef = new Chef(login_field.Text, password_field.Text); users.Chefs.Add(chef); MessageBox.Show("Пользователь успешно добавлен"); users.Save(); this.Close(); Main_admin main_adm = new Main_admin(); main_adm.Show(); } else { MessageBox.Show("Выберите статус"); } } } } }
// GET: Chefs/Details/5 public ActionResult Details(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } Chef chef = db.Chefs.Find(id); if (chef == null) { return(HttpNotFound()); } return(View(chef)); }
public IActionResult ChefUpdate(int ChefId, Chef dUpdated) { Chef chef = dbContext.Chefs.FirstOrDefault(d => d.ChefId == ChefId); chef.FirstName = dUpdated.FirstName; chef.LastName = dUpdated.LastName; chef.DOB = dUpdated.DOB; chef.ChefRating = dUpdated.ChefRating; chef.Description = dUpdated.Description; chef.DataImageUrlField = dUpdated.DataImageUrlField; chef.UpdatedAt = DateTime.Now; dbContext.SaveChanges(); return(View("ChefShow", chef)); }
public IActionResult ChefForm(string cmd, int chefID) { Chef chef = new Chef(); switch (cmd) { case "edit": chef = (Chef)dbContext.Chefs.FirstOrDefault(c => c.ChefID == chefID); return(View("ChefForm", chef)); case "add": default: return(View("ChefForm", chef)); } }
public IActionResult ProcessNewChef(Chef newChef) { if (ModelState.IsValid) { System.Console.WriteLine($"{newChef.FirstName} | {newChef.LastName}***************************************"); dbContext.Add(newChef); dbContext.SaveChanges(); return(RedirectToAction("Index")); } else { return(View("AddChefForm")); } }
public string Disapprove(int Id, string Role) { if (string.Equals(Role, "DBoy", StringComparison.OrdinalIgnoreCase)) { DeliveryBoy d = db.DeliveryBoy.Where(i => i.DeliveryBoyId == Id).FirstOrDefault(); d.Approved = false; using (var tr = db.Database.BeginTransaction()) { try { db.DeliveryBoy.Update(d); db.SaveChanges(); tr.Commit(); Utils.OrderEmail(d.Email, "Your account is locked by the KhanaGarKa.com team."); return("OK"); } catch { tr.Rollback(); } } } else if (string.Equals(Role, "Chef", StringComparison.OrdinalIgnoreCase)) { Chef c = db.Chef.Where(i => i.ChefId == Id).FirstOrDefault(); c.Approved = false; using (var tr = db.Database.BeginTransaction()) { try { db.Chef.Update(c); db.SaveChanges(); tr.Commit(); Utils.OrderEmail(c.Email, "Your account is locked by the KhanaGarKa.com team."); return("OK"); } catch { tr.Rollback(); } } } return(""); }
public IActionResult Details(int id) { Chef selectedChef = _db.Chefs .Include(c => c.Dishes) .FirstOrDefault(c => c.ChefId == id); if (selectedChef == null) { RedirectToAction("All"); } // ViewBag.uId = uId; return(View(selectedChef)); }
public ActionResult AssignOrderr(int id) { List <Chef> list = new List <Chef>(); Chef c = new Chef(); PassOrder cat = db.PassOrders.Find(id); if (cat != null) { ViewBag.msg = "This order has been assigned"; return(RedirectToAction("ViewOrders", "Admin")); } TempData["id"] = id; return(RedirectToAction("Index1", "Admin")); }
internal static void Main() { Potato goodPotato = new Potato(); Potato badPotato = new Potato(); Carrot carrot = new Carrot(); Chef gRamsay = new Chef("G - Ramsay"); gRamsay.PrepareVegetable(goodPotato); gRamsay.PrepareVegetable(carrot); Console.WriteLine("Test 1: (press any key for test 2)"); CookMeal(gRamsay, goodPotato, carrot); Console.WriteLine("Test 2:"); CookMeal(gRamsay, badPotato, carrot); }
public static void PrepareMeal() { var potato = GetPotato(); var chef = new Chef(); if (potato == null) { throw new ArgumentNullException(); } if((!potato.IsRotten)&&(potato.IsPeeled)) { var bowl = chef.Cook(); } else { throw new NotImplementedException(); } }
private static void Main() { Chef gosho = new Chef("Georgi", "Oklahoma"); Potato potato = new Potato(0.5, 0.3m); if (potato == null) { throw new ArgumentNullException("Vegetable item cannot be null"); } if (!potato.IsPeeled && potato.IsRotten) { throw new ArgumentException( "Vegetable must be not rotten and peeled before cooking"); } gosho.Cook(potato); }
internal static void CookMeal(Chef chef, Potato potato, Carrot carrot) { if (potato != null && chef != null) { if (potato.IsPeeled && !potato.IsRotten) { chef.Cook(potato, carrot); } else { Console.WriteLine(chef.Name + " ANGRY!!! " + chef.Name + " SMASHHH!!!"); Console.WriteLine("Don't you be givin me no rotten potatoes!"); Console.ReadLine(); } } else { Console.WriteLine("Where my potato AT!"); } }
static void Main() { Chef chef = new Chef(); chef.Cook(); }
public static void Main(string[] args) { Chef chef = new Chef(); chef.Cook(); }
public void EatFood(Chef sender, Food carryingFood) { MoveFoodToMouth(carryingFood, () => { Eating = true; GameController.Instance.FoodEaten(sender, carryingFood, true); } ); if (GameController.Instance.EatMirroredFoods) { ////also eat the food on the opposite side. //Chef mirrorChef = sender.GetMirrorChef(); //if (mirrorChef.CarryingFood != null) // mirrorChef.CarryingFood.Interact(); } }
public static void Main() { var chef = new Chef(); var result = chef.Cook(); result.Serve(); }
private static void Main() { Chef hristo = new Chef("Ico", "VelikoSelo"); hristo.Cook(); }
public static void Main() { Chef chef = new Chef(); chef.CookDish(); }
public static void Main() { var chef = new Chef(); var bowl = chef.Cook(); System.Console.WriteLine(bowl); }
public static void Main() { var chef = new Chef(); chef.Cook(); }