public void Delete(ShopOrder shopOrder, ShopCustomer shopCustomer, ShopOrderDetail shopOrderDetail)
 {
     context.ShopOrder.Remove(shopOrder);
     context.ShopCustomer.Remove(shopCustomer);
     context.ShopOrderDetail.Remove(shopOrderDetail);
     context.SaveChanges();
 }
 public void Delete(ShopCustomer delShopCustomer)
 {
     if (delShopCustomer != null)
     {
         db.ShopCustomer.Remove(delShopCustomer);
         db.SaveChanges();
     }
 }
        public ActionResult Register(ShopCustomer shopcustomer)
        {
            if (ModelState.IsValid)
            {
                db.ShopCustomer.Add(shopcustomer);
                db.SaveChanges();
                return(RedirectToAction("Login", "Account", new { Area = "FoodMapArea" }));
            }


            return(View());
        }
        public ShopCustomer AddCustomer(string userId, string name, string street, string city, string postalCode, string country)
        {
            ShopCustomer order = new ShopCustomer();

            order.UserId     = userId;
            order.Name       = name;
            order.Street     = street;
            order.City       = city;
            order.PostalCode = postalCode;
            order.Country    = country;

            context.ShopCustomer.Add(order);
            context.SaveChanges();

            return(order);
        }
        public ActionResult Login(ShopCustomer shopcustomer)
        {
            if (ModelState.IsValid)
            {
                var loginUser = db.ShopCustomer.FirstOrDefault(u => u.EmailAddress == shopcustomer.EmailAddress && u.Password == shopcustomer.Password);
                if (loginUser != null)
                {
                    Response.Cookies["UserName"].Value   = loginUser.FullName;
                    Response.Cookies["CustomerID"].Value = loginUser.CustomerID.ToString();
                    return(RedirectToAction("Index", "Customer", new { Area = "FoodMapArea" }));
                }
            }


            return(View());
        }
Esempio n. 6
0
    private void SpawnShopCustomer()
    {
        //Get a random inactive customer
        //Spawn them for a random time
        List <ShopCustomer> shopCustomers = new List <ShopCustomer>();

        for (int i = 0; i < transform.childCount; i++)
        {
            if (!transform.GetChild(i).gameObject.activeSelf)
            {
                shopCustomers.Add(transform.GetChild(i).GetComponent <ShopCustomer>());
            }
        }
        if (shopCustomers.Count > 0)
        {
            ShopCustomer shopCustomer = shopCustomers[UnityEngine.Random.Range(0, shopCustomers.Count)];
            if (shopCustomer != null)
            {
                shopCustomer.gameObject.SetActive(true);
                shopCustomer.lifetime = UnityEngine.Random.Range(MinVisitTime, MaxVisitTime);
            }
        }
    }