public ActionResult Index(LoginNewTbl login)
        {
            if (ModelState.IsValid)
            {
                var result = db.LoginNewTbls.Where(a => a.username.Equals(login.username) && a.pass.Equals(login.pass)).FirstOrDefault();

                if (result != null)
                {
                    Session["user"] = result.username;

                    return(RedirectToAction("Index", "TerimaOrder"));
                }
                ViewBag.errorlogin = "******";
                //TempData["MsgNoData"] = "Wrong Username Or Password";
                return(View());
            }

            return(View(login));
            //AccountModel accountModel = new AccountModel();
            //if (string.IsNullOrEmpty(Account.Username) || string.IsNullOrEmpty(AccountViewModel.Account.Password) || accountModel.login(AccountViewModel.Account.Username, AccountViewModel.Account.Password) == null)
            //{
            //    ViewBag.Error = "Please provide your username and password correct!!!";
            //    return View("Index");
            //}
            //SimpleSessionPersister.Username = AccountViewModel.Account.Username;
            //return View("Welcome");
        }
Beispiel #2
0
        public IHttpActionResult PutLoginNewTbl(int id, LoginNewTbl loginNewTbl)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != loginNewTbl.id)
            {
                return(BadRequest());
            }

            db.Entry(loginNewTbl).State = EntityState.Modified;

            try
            {
                db.SaveChanges();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!LoginNewTblExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(StatusCode(HttpStatusCode.NoContent));
        }
Beispiel #3
0
        public ActionResult DeleteConfirmed(int id)
        {
            LoginNewTbl loginNewTbl = db.LoginNewTbls.Find(id);

            db.LoginNewTbls.Remove(loginNewTbl);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
Beispiel #4
0
 public ActionResult Edit([Bind(Include = "id,username,email,pass")] LoginNewTbl loginNewTbl)
 {
     if (ModelState.IsValid)
     {
         db.Entry(loginNewTbl).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(loginNewTbl));
 }
Beispiel #5
0
        public IHttpActionResult GetLoginNewTbl(int id)
        {
            LoginNewTbl loginNewTbl = db.LoginNewTbls.Find(id);

            if (loginNewTbl == null)
            {
                return(NotFound());
            }

            return(Ok(loginNewTbl));
        }
Beispiel #6
0
        public ActionResult Create([Bind(Include = "id,username,email,pass")] LoginNewTbl loginNewTbl)
        {
            if (ModelState.IsValid)
            {
                db.LoginNewTbls.Add(loginNewTbl);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(loginNewTbl));
        }
Beispiel #7
0
        public IHttpActionResult PostLoginNewTbl(LoginNewTbl loginNewTbl)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            db.LoginNewTbls.Add(loginNewTbl);
            db.SaveChanges();

            return(CreatedAtRoute("DefaultApi", new { id = loginNewTbl.id }, loginNewTbl));
        }
Beispiel #8
0
        public IHttpActionResult DeleteLoginNewTbl(int id)
        {
            LoginNewTbl loginNewTbl = db.LoginNewTbls.Find(id);

            if (loginNewTbl == null)
            {
                return(NotFound());
            }

            db.LoginNewTbls.Remove(loginNewTbl);
            db.SaveChanges();

            return(Ok(loginNewTbl));
        }
Beispiel #9
0
        // GET: detail/Delete/5
        public ActionResult Delete(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            LoginNewTbl loginNewTbl = db.LoginNewTbls.Find(id);

            if (loginNewTbl == null)
            {
                return(HttpNotFound());
            }
            return(View(loginNewTbl));
        }