示例#1
0
        public async Task <IActionResult> Edit(int id, [Bind("UserId,UserFName,UserLName,UserEmail")] Enduser enduser)
        {
            if (id != enduser.UserId)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(enduser);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!EnduserExists(enduser.UserId))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(enduser));
        }
        public ActionResult VerifyOTP(string OTP, string HashCode, string OrderedItems, string username, string userPhone, string userEmail, string address, string restaurant)
        {
            ArrayList arrStatus = new ArrayList();
            var       rsa       = new RSAHelper(RSAType.RSA2, Encoding.UTF8, privateKey, publicKey);

            Enduser VerifyOTP = new Enduser
            {
                OTP = rsa.Decrypt(HashCode)
            };

            if (VerifyOTP.OTP == OTP)
            {
                // Insertion to tables and generation of order id code will go here..
                var OrderId = CreateNewOrder(OrderedItems, username, userPhone, userEmail, address, 1, "", restaurant);// delivery mode is 1(COD) and paymentID is blank
                if (OrderId != Guid.Empty)
                {
                    return(Json(OrderId));
                }
                else
                {
                    return(Json("00000000-0000-0000-0000-000000000000"));
                }
            }
            else
            {
                return(Json("Error"));
            }
        }
示例#3
0
        // register (User, out string) : void
        private void Register([Bind("UserId,UserFName,UserLName,UserEmail")] Enduser enduser,
                              [Bind("PasswordNew")] Userpassword userpassword, out string response)
        {
            DataAccess d = new DataAccess();

            d.Register(enduser, userpassword, out response);
        }
示例#4
0
        private bool GetValidation(int id, [Bind("UserEmail")] Enduser enduser, [Bind("PasswordNew")] Userpassword userpassword)
        {
            DataAccess d = new DataAccess();
            bool       v = d.Validate(enduser, userpassword);

            return(v);
        }
示例#5
0
        public ActionResult UserLogin(Enduser ULogin)
        {
            try
            {
                var model = db.UserList.Single(p => p.EUUsername == ULogin.EUUsername && p.EUPassword == ULogin.EUPassword);



                if (model != null)
                {
                    Session["UserName"] = model.EUUsername.ToString();
                    if (model.EUStatus == true)
                    {
                        return(RedirectToAction("Index", "Enduser"));
                    }
                    else
                    {
                        ModelState.AddModelError("", "Your account has been locked, please contact admin to unlock!!!");
                    }
                }
                else
                {
                    ModelState.AddModelError("", "The account or password is incorrect, please re-enter!!!");
                }
            }
            catch (Exception e)
            {
                ModelState.AddModelError("", e.Message);
            }
            Session["Login"] = "******";
            return(RedirectToAction("EUHome", "Home"));
        }
示例#6
0
        //------------------------------------------
        //----Edit Information(End-User)------------
        public ActionResult EditInforUser(string id)
        {
            Enduser model = db.UserList.SingleOrDefault(e => e.EUUsername == id);

            if (model == null)
            {
                Response.StatusCode = 404;
                return(null);
            }
            return(View(model));
        }
示例#7
0
        public async Task <IActionResult> Create([Bind("UserId,UserFName,UserLName,UserEmail")] Enduser enduser)
        {
            if (ModelState.IsValid)
            {
                _context.Add(enduser);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(enduser));
        }
示例#8
0
 public ActionResult EditInforUser(Enduser eUser)
 {
     try
     {
         db.Entry(eUser).State = System.Data.Entity.EntityState.Modified;
         db.SaveChanges();
         ModelState.AddModelError("", "Edit Complete!!!");
     }
     catch (Exception e)
     {
         ModelState.AddModelError("", e.Message);
     }
     return(View());
 }
示例#9
0
 public ActionResult CreateEndUser(Enduser newEndUser)
 {
     try
     {
         if (ModelState.IsValid)
         {
             db.Entry <Enduser>(newEndUser).State = System.Data.Entity.EntityState.Added;
             db.SaveChanges();
             ModelState.AddModelError("", "Add complete!!!");
         }
         else
         {
             ModelState.AddModelError("", "Fail");
         }
     }
     catch (Exception e)
     {
         ModelState.AddModelError("", e.Message);
     }
     return(View());
 }
示例#10
0
        public ActionResult VerifyOTP(string OTP, string HashCode)
        {
            ArrayList arrStatus = new ArrayList();
            var       rsa       = new RSAHelper(RSAType.RSA2, Encoding.UTF8, privateKey, publicKey);

            Enduser VerifyOTP = new Enduser
            {
                OTP = rsa.Decrypt(HashCode)
            };

            if (VerifyOTP.OTP == OTP)
            {
                // Insertion to tables and generation of order id code will go here..
                OrderId = GetOrderId();
                return(Json(OrderId));
            }
            else
            {
                return(Json("Error"));
            }
        }
示例#11
0
        public ActionResult DetailsInfoUser(Enduser eUser, string id)
        {
            var model = db.UserList.SingleOrDefault(e => e.EUUsername == id);

            return(View(model));
        }