예제 #1
0
        public static int SetLocation(dom.Location domloc)
        {
            var _db     = new PizzaStoreDbContext();
            var dataloc = new Location()
            {
                ModifiedDate = DateTime.Now
            };

            _db.Location.Add(dataloc);
            return(_db.SaveChanges());
        }
예제 #2
0
        public static dom.Location GetLocationByOrder(Order dr)
        {
            var _db       = new PizzaStoreDbContext();
            var dataStore = _db.Location.Where(l => l.LocationId == dr.StoreId).FirstOrDefault();

            dom.Location domstore = new dom.Location()
            {
                Id = dataStore.LocationId
                ,
                ModifiedDate = dataStore.ModifiedDate
            };


            return(domstore);
        }
예제 #3
0
        //public static double GetLocationSales(pdm.Location location)
        //{
        //    var orders = OrderHelper.GetOrderByLocation(location);
        //    var sum = 0D;

        //    foreach (var item in orders)
        //    {
        //        sum += item.Total;
        //    }

        //    return sum;
        //}

        //public static List<pdm.User> GetLocationUsers(pdm.Location location)
        //{
        //    var dataLocation = _db.Location.Where(l => l.LocationId == location.LocationId).FirstOrDefault();
        //    var users = new List<pdm.User>();

        //    foreach (var item in dataLocation.Order.ToList())
        //    {
        //        users.Add(new pdm.User()
        //        {
        //            UserId = item.User.UserId
        //        });
        //    }

        //    return users;
        //}

        public static bool SetLocation(pdm.Location location)
        {
            var dataLocation = new Location()
            {
                Name = location.Name
                       //Address = new Address()
                       //{
                       //    City = location.Address.City,
                       //    State = location.Address.State,
                       //    Street = location.Address.Street
                       //}
            };

            _db.Location.Add(dataLocation);

            return(_db.SaveChanges() == 1);
        }
예제 #4
0
        //private static PizzaStoreDbContext _db = new PizzaStoreDbContext();

        public static List <dom.Location> GetLocations()
        {
            var _db = new PizzaStoreDbContext();
            var ls  = new List <dom.Location>();

            foreach (var l in _db.Location.ToList())
            {
                if (l.Active == true)
                {
                    dom.Location store = new dom.Location()
                    {
                        Id           = l.LocationId,
                        ModifiedDate = l.ModifiedDate
                    };
                    ls.Add(store);
                }
            }

            return(ls);
        }