public static bool Update(KaryawanViewModel model)
        {
            bool result = true;

            try
            {
                using (var db = new TokoKonteks())
                {
                    if (model.Id == 0)
                    {
                        Mst_Karyawan Kry = new Mst_Karyawan();
                        Kry.Kode       = model.Kode;
                        Kry.Nama       = model.Nama;
                        Kry.Alamat     = model.Alamat;
                        Kry.NoHp       = model.NoHp;
                        Kry.Aktif      = model.Aktif;
                        Kry.DibuatOleh = "Test";
                        Kry.Dibuat     = DateTime.Now;
                        db.Mst_Karyawan.Add(Kry);
                        db.SaveChanges();
                    }
                    else
                    {
                        Mst_Karyawan Kry = db.Mst_Karyawan.Where(o => o.Id == model.Id).FirstOrDefault();
                        if (Kry != null)
                        {
                            Kry.Kode       = model.Kode;
                            Kry.Nama       = model.Nama;
                            Kry.Alamat     = model.Alamat;
                            Kry.NoHp       = model.NoHp;
                            Kry.Aktif      = model.Aktif;
                            Kry.DiubahOleh = "Test";
                            Kry.Diubah     = DateTime.Now;
                            db.SaveChanges();
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                Message = ex.Message;
                result  = false;
            }
            return(result);
        }
        public static bool Delete(int id)
        {
            bool result = true;

            try
            {
                using (var db = new TokoKonteks())
                {
                    Mst_Karyawan Kry = db.Mst_Karyawan.Where(o => o.Id == id).FirstOrDefault();
                    if (Kry != null)
                    {
                        db.Mst_Karyawan.Remove(Kry);
                        db.SaveChanges();
                    }
                }
            }
            catch (Exception ex)
            {
                Message = ex.Message;
                result  = false;
            }
            return(result);
        }