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 })); }
public StoreItemController(ApplicationDbContext db, IWebHostEnvironment hostingEnviroment) { _db = db; _hostingEnviroment = hostingEnviroment; StoreItemVM = new StoreItemViewModel() { Category = _db.Category, StoreItem = new Models.StoreItem() }; }
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); }
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++; } }
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); }
public StoreItemViewModel MapToDto(StoreItemEntity entity) { var dto = new StoreItemViewModel(entity.Id, entity.Code, entity.Data); return(dto); }
public StoreItemPage(List <ItemCatalogueModel> StoreItemsList) { InitializeComponent(); BindingContext = new StoreItemViewModel(Navigation, StoreItemsList); }