예제 #1
0
        public RConta ObtenerRconta(int id)
        {
            RConta item = new RConta();

            try {
                if (id == 0)
                {
                    return(item);
                }
                using (ClusmextContext context = new ClusmextContext()) {
                    item = context.RConta.Where(x => x.IdRConta == id).SingleOrDefault();
                }
            } catch (Exception ex) {
            }
            return(item);
        }
예제 #2
0
        public int Guardar(RConta item)
        {
            int Val = 0;

            try {
                using (ClusmextContext context = new ClusmextContext()) {
                    if (item.IdRConta > 0)
                    {
                        context.Entry(item).State = EntityState.Modified;
                    }
                    else
                    {
                        context.Entry(item).State = EntityState.Added;
                    }
                    Val = context.SaveChanges();
                }
            }
            catch (Exception ex)
            {
            }
            return(Val);
        }