public ActionResult DeleteConfirmed(int id) { Foodstuff foodstuff = db.Foodstuffs.Find(id); db.Foodstuffs.Remove(foodstuff); db.SaveChanges(); return(RedirectToAction("Index")); }
public ActionResult Edit([Bind(Include = "Id,Name")] Foodstuff foodstuff) { if (ModelState.IsValid) { db.Entry(foodstuff).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(foodstuff)); }
public ActionResult Create([Bind(Include = "Id,Name")] Foodstuff foodstuff) { if (ModelState.IsValid) { db.Foodstuffs.Add(foodstuff); db.SaveChanges(); return(RedirectToAction("Index")); } return(View(foodstuff)); }
public void ProcessRecipeFromBook(Recipe recipe) { foreach (string step in workSteps) { step.status == true; } if (workSteps.done) { Foodstuff foodstuff1 = new Foodstuff("Final Product", true); CheckForSatisfication(foodstuff1.satisfied); } }
// GET: Foodstuffs/Delete/5 public ActionResult Delete(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } Foodstuff foodstuff = db.Foodstuffs.Find(id); if (foodstuff == null) { return(HttpNotFound()); } return(View(foodstuff)); }
/* * private void SpriteReading()//SpriteDatasにImageDateの画像を格納 * { * SpriteDatas = new Sprite[TextDatas.Count()][]; * for (int i = 0; i < TextDatas.Count(); i++) * { * SpriteDatas[i] = new Sprite[TextDatas[i].Count()]; * for (int l = 0; l < TextDatas[i].Count(); l++) * { * for (int lp = 0; lp < ImageDatas.Length; lp++) * { * if (ImageDatas[lp].name == TextDatas[i][l]) * { * SpriteDatas[i][l] = ImageDatas[lp]; * } * * } * } * } * } */ private void CreateFSClass()//食材クラスの生成を行う { ///食材の数分の配列を用意→配列個数分ループ→名前と金額を入力しクラスを生成 //Debug.Log(MoneyDatas.Count);//正確な個数を出力していることを確認 //int[] test = { 20, 40, 60, 80, 100 };//仮作成用のテストデータ FS = new Foodstuff[MoneyDatas.Count]; //MoneyDatas.Count は食材の数。リストの要素数を出力している。リスト内の配列数を出力 string Fname = ""; //食材の名前を格納し画像を探すために保持する int[] Money = new int[5]; for (int i = 0; i < FS.Length; i++) //料理回数分ループ { Fname = MoneyDatas[i][0]; //食材名を取得 for (int l = 0; l < Money.Length; l++) //金額を格納する//基礎金額を入力し、内部で処理したほうが楽だが、後々の仕様変更を考え、この方式を採用 { Money[l] = int.Parse(MoneyDatas[i][l + 2].ToString()); //文字列である金額を整数値に変換し格納 } for (int l = 0; l < ImageDatas.Length; l++)//画像枚数分繰り返す { //Debug.Log(Fname +" , "+ ImageDatas[i].name); if (Fname == ImageDatas[l].name)//料理名とImageDatasの名前が一致する場合 { //Debug.Log("!!!!!!!!!!!!!!!!!!!!"); FS[i] = new Foodstuff(Fname, ImageDatas[l], Money);//各クラスを初期化、同時に素材名とSpritを格納 break; } if (l + 1 == ImageDatas.Length) { Debug.LogError("食材クラス生成 '" + Fname + " 'の画像がありません"); } } } //Debug.Log(MoneyDatas[0][0]); }
private static IEnumerable <IFoodstuff> ToFoodstuffs(SearchFoodstuffResponse response) => response.Foodstuffs.Select(f => Foodstuff.Create(f.Id, f.Name, f.ImageUrl, f.BaseAmount, f.AmountStep));