예제 #1
0
        public bool SuaQuyen(Quyens q)
        {
            try
            {
                db.Entry(q).State = EntityState.Modified;

                db.SaveChanges();
                return(true);
            }
            catch (Exception)
            {
                return(false);

                throw;
            }
        }
예제 #2
0
        public bool ThemQuyen(Quyens q)
        {
            try
            {
                var a = db.Quyens.FirstOrDefault(x => x.TenTW == q.TenTW && x.TenVT == q.TenVT);
                if (a == null)
                {
                    db.Quyens.Add(q);
                    db.SaveChanges();
                    return(true);
                }
                return(false);
            }
            catch (Exception)
            {
                return(false);

                throw;
            }
        }