Пример #1
0
        public IActionResult Create([Bind("Id,CustId,LocId,Username,Pwd")] OrderViewModel order)
        {
            string Username = order.Username, Password = order.Pwd;

            if (ModelState.IsValid)
            {
                int cid;
                var cst = TimeZoneInfo.FindSystemTimeZoneById("Central Standard Time");
                if (Password == (_custContext.VerifyCustomer(Username, out cid)))
                {
                    var new_order = new Order
                    {
                        LocId     = order.LocId,
                        CustId    = cid,
                        Total     = 0,
                        Timestamp = TimeZoneInfo.ConvertTime(DateTime.Now, cst)
                    };
                    TempData["OrderID"] = _context.Add(new_order);
                    TempData["StoreID"] = order.LocId;
                    logger.LogInformation("Order successfully created");
                    return(RedirectToAction("CreateOrderItem"));
                }
                else
                {
                    TempData["VerificationError"] = true;
                    return(RedirectToAction("Create"));
                }
            }
            return(View(order));
        }
Пример #2
0
        public void VerifyUser()
        {
            string pass = "", input = "";
            bool   verified = false;

            do
            {
                Console.WriteLine("Enter username or email:");
                input = Console.ReadLine().Trim();
                Console.WriteLine("Enter password:"******"Invalid username/pwd combo");
                }
                else
                {
                    verified = true;
                    Console.WriteLine($"\nLogging in as {input} with id {current_id}");
                }
            } while (!verified);
        }