예제 #1
0
        public string create(ProductStyleDto tProductStyleDto)
        {
            try
            {
                ProductStyle tProductStyleNew = mapper.Map <ProductStyleDto, ProductStyle>(tProductStyleDto);
                tProductStyleNew.Id         = Guid.NewGuid().ToString();
                tProductStyleNew.CreateDate = DateTime.Now;

                _context.ProductStyle.Add(tProductStyleNew);
                _context.SaveChanges();
                return("0");
            }
            catch (Exception)
            {
                return("1");
            }
        }
예제 #2
0
        public string update(ProductStyleDto tProductStyleDto)
        {
            try
            {
                ProductStyle tProductStyleUpdate = _context.ProductStyle.Find(tProductStyleDto.Id);
                if (tProductStyleUpdate == null)
                {
                    return("1");
                }
                tProductStyleUpdate.Name       = tProductStyleDto.Name;
                tProductStyleUpdate.Id         = tProductStyleDto.Id;
                tProductStyleUpdate.Status     = tProductStyleDto.Status;
                tProductStyleUpdate.CreateDate = tProductStyleDto.CreateDate;
                tProductStyleUpdate.CreateUser = tProductStyleDto.CreateUser;

                _context.ProductStyle.Update(tProductStyleUpdate);
                _context.SaveChanges();
                return("0");
            }
            catch (Exception)
            {
                return("1");
            }
        }
        public IActionResult Update([FromBody] ProductStyleDto value)
        {
            string result = _productStyleService.update(value);

            return(new ObjectResult(result));
        }