public JsonResult CreateMomoAPI([Bind(Include = "ID,NanpreNO,MakeUserID,IsPublic,Title,Remarks")] Momo momo) { if (ModelState.IsValid) { //SaveChangesを二回行うので本当は両方を範囲としたトランザクションが必要 momo.CreatedDateTime = DateTime.Now; momo.IsCleared = false; momo.NanpreNO = Int16.Parse(Request.QueryString["NanpreNO"].ToString()); momo.Title = Request.QueryString["Title"].ToString(); momo.MakeUserID = Request.QueryString["MakeUserID"].ToString(); momo.IsPublic = Request.QueryString["IsPublic"].ToString() == "True" ? true : false; momo.Remarks = string.Empty; db.Momoes.Add(momo); db.SaveChanges(); var momoState = new MomoState() { Momo_ID = momo.ID, CurrentNanpre = db.NanpreQuestions.FirstOrDefault(x => x.ID == momo.NanpreNO).Nanpre }; //CurrentNanpreがnullの場合の対応はいつかやる db.MomoStates.Add(momoState); db.SaveChanges(); return(null); } return(null); }
public ActionResult DeleteConfirmed(int id) { Momo momo = db.Momoes.Find(id); db.Momoes.Remove(momo); db.SaveChanges(); return(RedirectToAction("Index")); }
public void OpenCamera() { lastCamera.SetActive(false); clocktime = true; playerCombine.GetComponent <CombinePlayerControll>().camera = cvcamera; Mimi.GetComponent <PlayerMovement>().setReplayPoint(ReplayPoint); Momo.GetComponent <PlayerMovement>().setReplayPoint(ReplayPoint); }
public ActionResult Edit([Bind(Include = "ID,NanpreNO,MakeUserID,IsPublic,Title,Remarks")] Momo momo) { if (ModelState.IsValid) { db.Entry(momo).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(momo)); }
public ActionResult Create([Bind(Include = "ID,NanpreNO,MakeUserID,IsPublic,Title,Remarks")] Momo momo) { if (ModelState.IsValid) { db.Momoes.Add(momo); db.SaveChanges(); return(RedirectToAction("Index")); } return(View(momo)); }
// GET: Momoes/Details/5 public ActionResult Details(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } Momo momo = db.Momoes.Find(id); if (momo == null) { return(HttpNotFound()); } return(View(momo)); }
public ActionResult DeleteConfirmed(int id) { Momo momo = db.Momoes.Find(id); db.Momoes.Remove(momo); //紐付くMomoStateも削除 var momoState = db.MomoStates.FirstOrDefault(x => x.Momo_ID == id); db.MomoStates.Remove(momoState); db.SaveChanges(); return(RedirectToAction("Index")); }
// GET: Momoes/Edit/5 public ActionResult Edit(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } Momo momo = db.Momoes.Find(id); if (momo == null) { return(HttpNotFound()); } ViewBag.MaxNanpreNO = db.NanpreQuestions.Max(x => x.NanpreNO); return(View(momo)); }
public World(int Width = 30, int Height = 30) { //FIXME This doenst currently work because the worldcontroller creates the world //before the Astar grid is created //Check is the dimension respect the dimensions of the Pathfinding grid /*if(checkGridDimensions(Width, Height) == false){ * Debug.LogError("World dimensions dont match Grid dimensions"); * return; * }*/ this.Width = Width; this.Height = Height; this.food = new List <Food>(); this.theMomo = new Momo(); GenerateFood(); }
public ActionResult Edit([Bind(Include = "ID,NanpreNO,MakeUserID,IsPublic,Title,Remarks")] Momo momo) { if (ModelState.IsValid) { momo.CreatedDateTime = DateTime.Now; var momoState = db.MomoStates.FirstOrDefault(x => x.Momo_ID == momo.ID); momoState.CurrentNanpre = db.NanpreQuestions.FirstOrDefault(x => x.NanpreNO == momo.NanpreNO).Nanpre; momo.IsCleared = false; db.Entry(momo).State = EntityState.Modified; db.Entry(momoState).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(momo)); }
public ActionResult Create([Bind(Include = "ID,NanpreNO,MakeUserID,IsPublic,Title,Remarks")] Momo momo) { if (ModelState.IsValid) { //SaveChangesを二回行うので本当は両方を範囲としたトランザクションが必要 momo.CreatedDateTime = DateTime.Now; momo.IsCleared = false; db.Momoes.Add(momo); db.SaveChanges(); var momoState = new MomoState() { Momo_ID = momo.ID, CurrentNanpre = db.NanpreQuestions.FirstOrDefault(x => x.ID == momo.NanpreNO).Nanpre }; //CurrentNanpreがnullの場合の対応はいつかやる db.MomoStates.Add(momoState); db.SaveChanges(); return(RedirectToAction("Index")); } return(View(momo)); }