コード例 #1
0
        public bool CreateSanPham(SanPhamDTO dto)
        {
            var sp = dto.Map();

            try
            {
                _context.SanPhams.Add(sp);
                _context.SaveChanges();
            }
            catch (Exception ex)
            {
                throw new ArgumentException(ex.InnerException == null ? ex.Message : ex.InnerException.Message);
            }

            return(true);
        }
コード例 #2
0
        public bool CreateDanhMuc(DanhMucDTO dto)
        {
            var dm = dto.Map();

            try
            {
                _context.DanhMucs.Add(dm);
                _context.SaveChanges();
            }
            catch (Exception ex)
            {
                throw new ArgumentException(ex.InnerException == null ? ex.Message : ex.InnerException.Message);
            }
            return(true);
        }