コード例 #1
0
        public JsonResult SaveStoreItem(StoreItemViewModel storeItem)
        {
            storeItemService.Save(new StoreItemDTO {
                ItemName = storeItem.ItemName, ItemCost = storeItem.ItemCost, StoreItemID = storeItem.StoreItemID
            });

            return(Json(new { Status = true, Message = string.Empty }));
        }
コード例 #2
0
 public StoreItemController(ApplicationDbContext db, IWebHostEnvironment hostingEnviroment)
 {
     _db = db;
     _hostingEnviroment = hostingEnviroment;
     StoreItemVM        = new StoreItemViewModel()
     {
         Category  = _db.Category,
         StoreItem = new Models.StoreItem()
     };
 }
コード例 #3
0
        private bool TryGetStoreViewModel(string storeCode, out StoreItemViewModel storeViewModel)
        {
            var result = GetAllStoreViewModels()
                         .FirstOrDefault(x => x.Code == storeCode);

            if (result != null)
            {
                storeViewModel = result;
                return(true);
            }

            storeViewModel = null;
            return(false);
        }
コード例 #4
0
        public void AddItem(StoreItemViewModel item)
        {
            // optimize this with a hash table lookup
            var match = items.FirstOrDefault(i => i.Item.ItemId == item.ItemId);

            if (match == null)
            {
                ShoppingCartItem cartItem = new ShoppingCartItem()
                {
                    Item     = item,
                    Quantity = 1
                };
                items.Add(cartItem);
            }
            else
            {
                match.Quantity++;
            }
        }
コード例 #5
0
        public StoreItemViewModel Get(ObjectId id)
        {
            var dm = _storeRepository.FindOne(store => store.Id == id);
            var vm = new StoreItemViewModel()
            {
                Id              = dm.Id,
                SecondaryId     = dm.SecondaryId,
                Name            = dm.Name,
                Description     = dm.Description,
                City            = dm.City,
                PictureUri      = _uriComposer.ComposePicUri(dm.PictureUri),
                Phone           = dm.Phone,
                ZipCode         = dm.ZipCode,
                Address         = dm.Address,
                State           = dm.State,
                License         = dm.License,
                DeliveryZipCode = dm.DeliveryZipCode
            };

            return(vm);
        }
コード例 #6
0
    public StoreItemViewModel MapToDto(StoreItemEntity entity)
    {
        var dto = new StoreItemViewModel(entity.Id, entity.Code, entity.Data);

        return(dto);
    }
コード例 #7
0
 public StoreItemPage(List <ItemCatalogueModel> StoreItemsList)
 {
     InitializeComponent();
     BindingContext = new StoreItemViewModel(Navigation, StoreItemsList);
 }