Пример #1
0
        public int Delete(KHOANGGIA model)
        {
            KHOANGGIA dbEntry = context.KHOANGGIAs.Find(model.IDKG);

            if (dbEntry != null)
            {
                context.KHOANGGIAs.Remove(dbEntry);
                context.SaveChanges();
            }
            return(model.IDKG);
        }
Пример #2
0
        public int Insert(KHOANGGIA model)
        {
            KHOANGGIA dbEntry = context.KHOANGGIAs.Find(model.IDKG);

            if (dbEntry != null)
            {
                return(-1);
            }
            context.KHOANGGIAs.Add(model);
            context.SaveChanges();
            return(model.IDKG);
        }
Пример #3
0
        public int Update(KHOANGGIA model)
        {
            KHOANGGIA dbEntry = context.KHOANGGIAs.Find(model.IDKG);

            if (dbEntry == null)
            {
                return(-1);
            }
            dbEntry.IDKG    = model.IDKG;
            dbEntry.cantren = model.cantren;
            dbEntry.canduoi = model.canduoi;

            context.SaveChanges();
            return(model.IDKG);
        }
Пример #4
0
        public KHOANGGIA FindEntity(int IDKG)
        {
            KHOANGGIA dbEntry = context.KHOANGGIAs.Find(IDKG);

            return(dbEntry);
        }