Ejemplo n.º 1
0
        public static void Eliminar(int pkCandidata)
        {
            try
            {
                using (var ctx = new DataModel())
                {
                    Candidata nCandidata = ManejoCandidata.getById(pkCandidata);
                    nCandidata.bStatus = false;

                    ctx.Entry(nCandidata).State = EntityState.Modified;
                    ctx.SaveChanges();
                }
            }
            catch (Exception)
            {
                throw;
            }
        }
Ejemplo n.º 2
0
        public static void Like(int pkCandidata)
        {
            Candidata nCandidata = ManejoCandidata.getById(pkCandidata);

            try
            {
                using (var ctx = new DataModel())
                {
                    int likes = nCandidata.iLike;
                    int like  = 1;
                    likes += like;

                    nCandidata.iLike = likes;
                    ctx.Candidatas.Attach(nCandidata);
                    ctx.Entry(nCandidata).State = EntityState.Modified;
                    ctx.SaveChanges();
                }
            }
            catch (Exception)
            {
                throw;
            }
        }