public static bool insert(Models.barang data)
 {
     bool result = false;
     try
     {
         using (var db = new Models.jotunContext())
         {
             db.Entry(data).State = EntityState.Added;
             db.SaveChanges();
             result = true;
         }
     }
     catch (Exception ex)
     {
         Helpers.Generic.MsgError(ex.Message);
     }
     return result;
 }
Пример #2
0
        public static bool delete(Models.karyawan data)
        {
            bool result = false;

            try
            {
                using (var db = new Models.jotunContext())
                {
                    db.Entry(data).State = EntityState.Deleted;
                    db.SaveChanges();
                    result = true;
                }
            }
            catch (Exception ex)
            {
                Helpers.Generic.MsgError(ex.Message);
            }
            return(result);
        }