Exemplo n.º 1
0
        public async Task <bool> AddSupplierProductAsync(PersonProduct model)
        {
            try {
                await _context.PersonProducts.AddAsync(model);

                return(true);
            } catch (System.Exception) {
                return(false);
            }
        }
Exemplo n.º 2
0
        public async Task <ActionResult <PersonProductDto> > DeleteSupplierProduct(PersonProduct model)
        {
            var entity = await _repository.DeleteSupplierProductAsync(model);

            if (entity == null)
            {
                return(NotFound());
            }

            await _repository.CommitAsync();

            return(entity);
        }
Exemplo n.º 3
0
        public async Task <bool> AddSupplierProduct(PersonProduct model)
        {
            var rs = await _repository.AddSupplierProductAsync(model);

            if (rs == true)
            {
                await _repository.CommitAsync();

                return(true);
            }

            return(false);
        }
Exemplo n.º 4
0
        public async Task <PersonProductDto> DeleteSupplierProductAsync(PersonProduct model)
        {
            var entity = await _context.PersonProducts
                         .FirstOrDefaultAsync(p => p.PersonId == model.PersonId &&
                                              p.ProductId == model.ProductId);

            if (entity != null)
            {
                _context.PersonProducts.Remove(entity);
            }

            return(entity.Adapt <PersonProductDto> ());
        }
Exemplo n.º 5
0
        public ActionResult AddItem(HttpPostedFileBase[] Image, PersonProduct PP)
        {
            Manager M = new Manager();

            string [] fileNames = new string[Image.Length];
            for (int i = 0; i < 5; i++)
            {
                Guid g = Guid.NewGuid();
                Image[i].SaveAs(Server.MapPath("~/Uploads/" + g + ".jpg"));
                fileNames[i] = g.ToString() + ".jpg";
            }
            M.AddPersonPoduct(PP, fileNames);

            //M.AddPersonPoduct(PP, g.ToString() + ".jpg");
            return(View());
        }