Beispiel #1
0
        public int Add(DEPARTEMEN departemen)
        {
            var result = 0;

            try
            {
                context.DEPARTEMEN.Add(departemen);
                result = context.SaveChanges();
            }
            catch
            {
                result = -1;
            }
            return(result);
        }
Beispiel #2
0
        public int Edit(int id, DEPARTEMEN departemen)
        {
            var result = 0;

            try
            {
                var exsitingdepartemen = context.DEPARTEMEN.Find(id);
                exsitingdepartemen.KARYAWAN  = departemen.KARYAWAN;
                exsitingdepartemen.KARYAWAN1 = departemen.KARYAWAN1;

                result = context.SaveChanges();
            }
            catch
            {
                result = -1;
            }

            return(result);
        }