Example #1
0
        public Ca_CS ObtenerCS(int id)
        {
            Ca_CS cs = new Ca_CS();

            try {
                using (ClusmextContext context = new ClusmextContext()) {
                    cs = context.Ca_CS.Where(x => x.Id_CS == id).SingleOrDefault();
                    if (id == 0)
                    {
                        cs.Id_Usuario = -1;
                    }
                }
            }
            catch (Exception ex) {
            }
            return(cs);
        }
Example #2
0
        public int Guardar(Ca_CS cs)
        {
            int val = 0;

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