Exemplo n.º 1
0
        public ActionResult Edit(int id = 0)
        {
            helloworlds helloworlds = db.helloworlds.Find(id);

            if (helloworlds == null)
            {
                return(HttpNotFound());
            }
            return(View(helloworlds));
        }
Exemplo n.º 2
0
        public ActionResult Create(helloworlds helloworlds)
        {
            if (ModelState.IsValid)
            {
                db.helloworlds.Add(helloworlds);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(helloworlds));
        }
Exemplo n.º 3
0
 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));
 }
Exemplo n.º 4
0
 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));
 }
Exemplo n.º 5
0
        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);
            //}
        }