Exemple #1
0
        public bool Update(CategoryCreateDTO req)
        {
            using (var db = new SqlSugarClient(Connection))
            {
                bool       result = true;
                R_Category model  = new R_Category()
                {
                    Id           = req.Id,
                    Name         = req.Name,
                    Description  = req.Description,
                    DiscountRate = req.DiscountRate,
                    PId          = req.Pid,
                    IsDiscount   = req.IsDiscount,
                    Sorted       = req.Sorted
                };

                result = db.Update(model);
                return(result);
            }
        }
Exemple #2
0
        public bool Create(CategoryCreateDTO req)
        {
            using (var db = new SqlSugarClient(Connection))
            {
                bool       result = true;
                R_Category model  = new R_Category()
                {
                    Name         = req.Name,
                    Description  = req.Description,
                    DiscountRate = req.DiscountRate,
                    PId          = req.Pid,
                    IsDiscount   = req.IsDiscount,
                    Sorted       = req.Sorted,
                    R_Company_Id = req.R_Company_Id
                };

                if (db.Insert(model) == null)
                {
                    result = false;
                }

                return(result);
            }
        }