Exemplo n.º 1
0
        public static x_religion getDataByKode(long id)
        {
            x_religion data = new x_religion();

            using (DBSpecEntities db = new DBSpecEntities())
            {
                data = db.x_religion.Where(a => a.id == id).FirstOrDefault();
            }
            return(data);
        }
Exemplo n.º 2
0
 public static string CekNama(string name)
 {
     using (DBSpecEntities db = new DBSpecEntities())
     {
         x_religion dt = db.x_religion.Where(a => a.name.Equals(name)).Where(a => a.is_delete == false).FirstOrDefault();
         if (dt != null)
         {
             return("ada");
         }
         else
         {
             return("tidak ada");
         }
     }
 }
Exemplo n.º 3
0
        public static bool DeleteData(long id)
        {
            try
            {
                using (DBSpecEntities db = new DBSpecEntities())
                {
                    x_religion dtRel = getDataByKode(id);

                    dtRel.is_delete       = true;
                    dtRel.deleted_on      = DateTime.Now;
                    db.Entry(dtRel).State = EntityState.Modified;
                    db.SaveChanges();
                }
                return(true);
            }
            catch (Exception)
            {
                return(false);

                throw;
            }
        }
Exemplo n.º 4
0
        public static bool SaveData(x_religion rel)
        {
            try
            {
                using (DBSpecEntities db = new DBSpecEntities())
                {
                    rel.created_by = 1;
                    rel.created_on = System.DateTime.Now;
                    rel.is_delete  = false;

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

                throw;
            }
        }
Exemplo n.º 5
0
        public static bool UpdateData(x_religion rel)
        {
            try
            {
                using (DBSpecEntities db = new DBSpecEntities())
                {
                    x_religion dtRel = db.x_religion.Where(a => a.id == rel.id).FirstOrDefault();
                    dtRel.name        = rel.name;
                    dtRel.description = rel.description;
                    dtRel.modified_on = DateTime.Now;


                    db.Entry(dtRel).State = EntityState.Modified;
                    db.SaveChanges();
                }
                return(true);
            }
            catch (Exception)
            {
                return(false);

                throw;
            }
        }