Exemple #1
0
        public bool Create(VProdAddForm prod)
        {
            var oldProd = wms.TProdProducts.Where(x => x.Code == prod.Code).FirstOrDefault();

            if (oldProd == null)
            {
                TProdProduct t = new TProdProduct
                {
                    Code      = prod.Code,
                    Name      = prod.Name,
                    BrandId   = prod.BrandId,
                    BrandCode = prod.BrandCode
                };

                t.CreatedBy   = DefaultUser.UserName;
                t.CreatedTime = DateTime.UtcNow;
                wms.TProdProducts.Add(t);
                return(wms.SaveChanges() > 0);
            }
            else
            {
                return(false);
            }
        }
Exemple #2
0
        public JsonResult Create([FromBody] VProdAddForm prod)
        {
            var result = productService.Create(prod);

            return(new JsonResult(result));
        }