Ejemplo n.º 1
0
        public async Task <IActionResult> UploadPic(PicVM <int> model)
        {
            string file = await _common.UploadPic(model.Img);

            if (!string.IsNullOrEmpty(file))
            {
                if (ModelState.IsValid)
                {
                    if (await _offertService.UploadImg(new ImageOffert
                    {
                        ImageName = file,
                        OffertId = model.Id,
                    }))
                    {
                        TempData["Offert"] = "Imagen cargada correctamente";
                    }
                }
            }
            return(RedirectToAction("Offerts", "Admin"));
        }
Ejemplo n.º 2
0
        public async Task <IActionResult> UploadPic(PicVM <Guid> model)
        {
            var file = await _common.UploadPic(model.Img);

            if (!string.IsNullOrEmpty(file))
            {
                if (ModelState.IsValid)
                {
                    if (await _service.UplodadPic(new ProductPic
                    {
                        ProductId = model.Id,
                        CreatedAt = DateTime.Now,
                        PicName = file
                    }))
                    {
                        TempData["Product"] = "Imagen cargada correctamente";
                    }
                }
            }
            return(RedirectToAction("Products", "Admin"));
        }
Ejemplo n.º 3
0
 public PicCommand(PicVM viewModel)
 {
     this.viewModel = viewModel;
 }
Ejemplo n.º 4
0
 public ListPicPage()
 {
     InitializeComponent();
     viewModel      = new PicVM();
     BindingContext = viewModel;
 }