コード例 #1
0
ファイル: HomePage.xaml.cs プロジェクト: eduardoagr/Kfc
        private async void CvProducts_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            PopularProduct SelectedItem = e.CurrentSelection.FirstOrDefault() as PopularProduct;

            if (SelectedItem != null)
            {
                await Navigation.PushModalAsync(new ProductDetailPage(SelectedItem.id));

                ((CollectionView)sender).SelectedItem = null;
            }
        }
コード例 #2
0
        public async Task <IActionResult> PopularProductCreate(PopularProductModel productModel, IFormFile formFile)
        {
            var entity = new PopularProduct()
            {
                Title = productModel.Title,
                Url   = productModel.Url
            };

            if (formFile != null)
            {
                var extention  = Path.GetExtension(formFile.FileName);
                var randomName = string.Format($"{Guid.NewGuid()}{extention}");
                entity.Image = randomName;
                var path = Path.Combine(Directory.GetCurrentDirectory(), "wwwroot\\img", randomName);

                using (var stream = new FileStream(path, FileMode.Create))
                {
                    await formFile.CopyToAsync(stream);
                }
            }
            _popularProductServices.Create(entity);
            return(RedirectToAction("PopularProductList"));
        }
コード例 #3
0
 public void Update(PopularProduct Entity)
 {
     _popularProductRepository.Update(Entity);
 }
コード例 #4
0
 public void Delete(PopularProduct Entity)
 {
     _popularProductRepository.Delete(Entity);
 }
コード例 #5
0
 public void Create(PopularProduct Entity)
 {
     _popularProductRepository.Create(Entity);
 }