Exemple #1
0
        public async Task <IActionResult> PutIntegrantesPorGrupo(int id, IntegrantesPorGrupo integrantesPorGrupo)
        {
            if (id != integrantesPorGrupo.IdIntegrantesPorGrupos)
            {
                return(BadRequest());
            }

            _context.Entry(integrantesPorGrupo).State = EntityState.Modified;

            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!IntegrantesPorGrupoExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(NoContent());
        }
Exemple #2
0
        public int SaveChanges()
        {
            IntegrantesPorGrupo entity = new IntegrantesPorGrupo
            {
                estado             = estado,
                fecha_creacion     = fecha_creacion,
                fecha_modificacion = fecha_modificacion,
                idestudiante       = idestudiante,
                idgrupo            = idgrupo,
                user_crea          = user_crea,
                user_modif         = user_modif
            };

            int salida = 0;

            switch (states)
            {
            case EntityStates.Add:
                salida = repositorioDataModel.Add(entity);
                break;

            case EntityStates.Delete:
                salida = repositorioDataModel.Delete(entity);
                break;

            case EntityStates.Update:
                salida = repositorioDataModel.Edit(entity);
                break;

            default:
                break;
            }
            return(salida);
        }
 public int Edit(IntegrantesPorGrupo entity)
 {
     try
     {
         using (var db = new BitacorasContexto())
         {
             db.Entry(entity).State = System.Data.Entity.EntityState.Modified;
             return(db.SaveChanges());
         }
     }
     catch (Exception e)
     {
         log.Error(DateTime.Now + " " + e);
         return(0);
     }
 }
 public int Delete(IntegrantesPorGrupo entity)
 {
     try
     {
         using (var db = new BitacorasContexto())
         {
             db.IntegrantesPorGrupo.Remove(entity);
             return(db.SaveChanges());
         }
     }
     catch (Exception e)
     {
         log.Error(DateTime.Now + " " + e);
         return(0);
     }
 }
Exemple #5
0
        public async Task <ActionResult <IntegrantesPorGrupo> > PostIntegrantesPorGrupo(IntegrantesPorGrupo integrantesPorGrupo)
        {
            _context.IntegrantesPorGrupo.Add(integrantesPorGrupo);
            await _context.SaveChangesAsync();

            return(CreatedAtAction("GetIntegrantesPorGrupo", new { id = integrantesPorGrupo.IdIntegrantesPorGrupos }, integrantesPorGrupo));
        }