public ActionResult Edit(int id = 0) { helloworlds helloworlds = db.helloworlds.Find(id); if (helloworlds == null) { return(HttpNotFound()); } return(View(helloworlds)); }
public ActionResult Create(helloworlds helloworlds) { if (ModelState.IsValid) { db.helloworlds.Add(helloworlds); db.SaveChanges(); return(RedirectToAction("Index")); } return(View(helloworlds)); }
public ActionResult Introduce(helloworlds helloworlds) { if (helloworlds.skill == null) { helloworlds.skill = "1"; } else { helloworlds.skill = (int.Parse(helloworlds.skill) + 1).ToString(); } if (ModelState.IsValid) { db.Entry(helloworlds).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("rank")); } return(View(helloworlds)); }
public ActionResult Edit(helloworlds helloworlds) { if (ModelState.IsValid) { try { db.Entry(helloworlds).State = EntityState.Modified; db.SaveChanges(); var returnData = new { IsSuccess = true }; return(Content(Newtonsoft.Json.JsonConvert.SerializeObject(returnData), "application/json")); //return Json(true, JsonRequestBehavior.AllowGet); } catch { var returnData = new { IsSuccess = false }; return(Content(Newtonsoft.Json.JsonConvert.SerializeObject(returnData), "application/json")); //return Json(false, JsonRequestBehavior.AllowGet); } } return(View(helloworlds)); }
public ActionResult DeleteConfirmed(int id) { if (!id.Equals("")) { try { var returnData = new { IsSuccess = true }; helloworlds helloworlds = db.helloworlds.Find(id); db.helloworlds.Remove(helloworlds); db.SaveChanges(); return(Content(Newtonsoft.Json.JsonConvert.SerializeObject(returnData), "application/json")); } catch { var returnData = new { IsSuccess = false }; return(Content(Newtonsoft.Json.JsonConvert.SerializeObject(returnData), "application/json")); } } else { var returnData = new { IsSuccess = false }; return(Content(Newtonsoft.Json.JsonConvert.SerializeObject(returnData), "application/json")); } //try //{ // helloworlds helloworlds = db.helloworlds.Find(id); // db.helloworlds.Remove(helloworlds); // db.SaveChanges(); // return Json(true, JsonRequestBehavior.AllowGet); //} //catch //{ // return Json(false, JsonRequestBehavior.AllowGet); //} }