예제 #1
0
        public string create(ProductSexDto tProductSexDto)
        {
            try
            {
                ProductSex tProductSexNew = mapper.Map <ProductSexDto, ProductSex>(tProductSexDto);
                tProductSexNew.Id         = Guid.NewGuid().ToString();
                tProductSexNew.CreateDate = DateTime.Now;

                _context.ProductSex.Add(tProductSexNew);
                _context.SaveChanges();
                return("0");
            }
            catch (Exception)
            {
                return("1");
            }
        }
예제 #2
0
        //Update
        public string update(ProductSexDto tProductSexDto)
        {
            try
            {
                ProductSex tProductSexUpdate = _context.ProductSex.Find(tProductSexDto.Id);
                if (tProductSexUpdate == null)
                {
                    return("1");
                }
                tProductSexUpdate.Name       = tProductSexDto.Name;
                tProductSexUpdate.Id         = tProductSexDto.Id;
                tProductSexUpdate.Status     = tProductSexDto.Status;
                tProductSexUpdate.CreateDate = tProductSexDto.CreateDate;
                tProductSexUpdate.CreateUser = tProductSexDto.CreateUser;

                _context.ProductSex.Update(tProductSexUpdate);
                _context.SaveChanges();
                return("0");
            }
            catch (Exception)
            {
                return("1");
            }
        }
예제 #3
0
        public IActionResult Update([FromBody] ProductSexDto value)
        {
            string result = _productSexService.update(value);

            return(new ObjectResult(result));
        }