Exemple #1
0
        public IHttpActionResult AddUser(string username, string pass, string createdate, String ipserver, int status)
        {
            try
            {
                var tblDoge = new TblDoge
                {
                    UserName    = username,
                    Pass        = pass,
                    Money       = "0",
                    Status      = status,
                    CreateDate  = new DateTime(long.Parse(createdate)).ToString(),
                    ipServer    = ipserver,
                    statusEnd   = 0,
                    statusStart = 0
                };
                db.TblDoges.Add(tblDoge);
                db.SaveChanges();
                return(Json(new { Result = "1" }));
            }
            catch (Exception x)
            {
                return(Json(new { Result = x }));

                throw;
            }
        }
Exemple #2
0
        public ActionResult DeleteConfirmed(int id)
        {
            TblDoge tblDoge = db.TblDoges.Find(id);

            db.TblDoges.Remove(tblDoge);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
Exemple #3
0
 public ActionResult Edit([Bind(Include = "Id,UserName,Status,Money,Pass")] TblDoge tblDoge)
 {
     if (ModelState.IsValid)
     {
         db.Entry(tblDoge).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(tblDoge));
 }
Exemple #4
0
        public ActionResult Create([Bind(Include = "Id,UserName,Status,Money,Pass")] TblDoge tblDoge)
        {
            if (ModelState.IsValid)
            {
                db.TblDoges.Add(tblDoge);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(tblDoge));
        }
Exemple #5
0
        // GET: AdminDoge/Delete/5
        public ActionResult Delete(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            TblDoge tblDoge = db.TblDoges.Find(id);

            if (tblDoge == null)
            {
                return(HttpNotFound());
            }
            return(View(tblDoge));
        }
Exemple #6
0
        public IHttpActionResult UpdateMoney(string username, string money)
        {
            try
            {
                var     tblDoge = db.TblDoges.Where(x => x.UserName == username).Select(x => x.Id).FirstOrDefault();
                TblDoge tbl     = db.TblDoges.Find(tblDoge);
                tbl.Money           = money;
                db.Entry(tbl).State = EntityState.Modified;
                db.SaveChanges();
                return(Json(new { Result = "1" }));
            }
            catch (Exception x)
            {
                return(Json(new { Result = x }));

                throw;
            }
        }