public bool anularDB(tb_Religion_Info info)
        {
            try
            {
                using (Entities_general Context = new Entities_general())
                {
                    tb_Religion Entity = Context.tb_Religion.FirstOrDefault(q => q.IdReligion == info.IdReligion);
                    if (Entity == null)
                    {
                        return(false);
                    }
                    Entity.Estado             = info.Estado = false;
                    Entity.MotivoAnulacion    = info.MotivoAnulacion;
                    Entity.IdUsuarioAnulacion = info.IdUsuarioAnulacion;
                    Entity.FechaAnulacion     = info.FechaAnulacion = DateTime.Now;
                    Context.SaveChanges();
                }

                return(true);
            }
            catch (Exception)
            {
                throw;
            }
        }
        public bool guardarDB(tb_Religion_Info info)
        {
            try
            {
                using (Entities_general Context = new Entities_general())
                {
                    tb_Religion Entity = new tb_Religion
                    {
                        IdReligion        = info.IdReligion = getId(),
                        NomReligion       = info.NomReligion,
                        Estado            = true,
                        IdUsuarioCreacion = info.IdUsuarioCreacion,
                        FechaCreacion     = info.FechaCreacion = DateTime.Now
                    };
                    Context.tb_Religion.Add(Entity);

                    Context.SaveChanges();
                }
                return(true);
            }
            catch (Exception)
            {
                throw;
            }
        }
Beispiel #3
0
 public ResponseData AddByEntity(ReligionViewModel data)
 {
     using (SATEntities db = new SATEntities())
     {
         ResponseData result = new Models.ResponseData();
         try
         {
             tb_Religion model = new tb_Religion();
             model.RelD       = data.RelD;
             model.RelName    = data.RelName;
             model.RelStatus  = (data.Status == "1") ? true : false;
             model.CreateBy   = UtilityService.User.UserID;
             model.CreateDate = DateTime.Now;
             model.ModifyBy   = UtilityService.User.UserID;
             model.ModifyDate = DateTime.Now;
             db.tb_Religion.Add(model);
             db.SaveChanges();
         }
         catch (Exception)
         {
         }
         return(result);
     }
 }