示例#1
0
 public ActionResult Edit_Mark(Marks model)
 {
     if (ValidMark(model))
     {
         db.Entry(model).State = System.Data.Entity.EntityState.Modified;
         db.SaveChanges();
     }
     return(RedirectToAction("Select"));
 }
示例#2
0
        public async Task <IActionResult> editar(int id, RegisterModel usuario)
        {
            if (id != usuario.cod_usuario)
            {
                return(BadRequest());
            }

            Usuario reg = _context.Usuario.Find(usuario.cod_usuario);

            if (reg.correo_electronico != usuario.correo_electronico)
            {
                if (_context.Usuario.Any(x => x.correo_electronico == usuario.correo_electronico))
                {
                    return(BadRequest());
                }
            }
            reg.nombre_completo    = usuario.nombre_completo;
            reg.estado             = usuario.estado;
            reg.fec_creacion       = DateTime.Now;
            reg.cod_rol            = usuario.cod_rol;
            reg.correo_electronico = usuario.correo_electronico;


            if (!string.IsNullOrWhiteSpace(usuario.contrasenia))
            {
                byte[] passwordHash, passwordSalt;
                CreatePasswordHash(usuario.contrasenia, out passwordHash, out passwordSalt);

                reg.contrasenia = passwordHash;
                reg.salt        = passwordSalt;
            }

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

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

            return(NoContent());
        }
示例#3
0
        public async Task <IActionResult> PutTbInventario(int id, TbInventario tbInventario)
        {
            if (id != tbInventario.CodInventario)
            {
                return(BadRequest());
            }

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

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

            return(NoContent());
        }
示例#4
0
        public async Task <IActionResult> PutRol(int id, Rol rol)
        {
            if (id != rol.IdRol)
            {
                return(BadRequest());
            }

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

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

            return(NoContent());
        }
示例#5
0
        public IHttpActionResult Putpeople(int id, people people)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != people.id)
            {
                return(BadRequest());
            }

            db.Entry(people).State = EntityState.Modified;

            try
            {
                db.SaveChanges();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!peopleExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(StatusCode(HttpStatusCode.NoContent));
        }
        PutTbProducto(int id, TbProducto tbProducto)
        {
            if (id != tbProducto.CodProducto)
            {
                return(BadRequest());
            }
            tbProducto.FechaModificacion     = DateTime.Now;
            _context.Entry(tbProducto).State = EntityState.Modified;

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

            return(NoContent());
        }
示例#7
0
        public async Task<IActionResult> PutTbTransaccion(int id, TbTransaccion tbTransaccion)
        {
            if (id != tbTransaccion.CodTransaccion)
            {
                return BadRequest();
            }

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

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

            return NoContent();
        }
示例#8
0
 public void UpdateProduct(Product product)
 {
     using (var context = new BDContext())
     {
         context.Entry(product).State = System.Data.Entity.EntityState.Modified;
         context.SaveChanges();
     }
 }
示例#9
0
 public void UpdateBitacora(BackEnd.ENTITIES.Bitacora bitacora)
 {
     using (context = new BDContext())
     {
         context.Entry(bitacora).State = System.Data.Entity.EntityState.Modified;
         context.SaveChanges();
     }
 }
示例#10
0
 public void UpdateRol(Roles rol)
 {
     using (context = new BDContext())
     {
         context.Entry(rol).State = System.Data.Entity.EntityState.Modified;
         context.SaveChanges();
     }
 }
 public void UpdateProyeccion(Proyeccion proyeccion)
 {
     using (context = new BDContext())
     {
         context.Entry(proyeccion).State = System.Data.Entity.EntityState.Modified;
         context.SaveChanges();
     }
 }
 public void UpdateFormato(Formato formato)
 {
     using (context = new BDContext())
     {
         context.Entry(formato).State = System.Data.Entity.EntityState.Modified;
         context.SaveChanges();
     }
 }
示例#13
0
 public void UpdateGenero(Genero genero)
 {
     using (context = new BDContext())
     {
         context.Entry(genero).State = System.Data.Entity.EntityState.Modified;
         context.SaveChanges();
     }
 }
示例#14
0
 public void UpdatePrivilegio(Privilegios privilegios)
 {
     using (context = new BDContext())
     {
         context.Entry(privilegios).State = System.Data.Entity.EntityState.Modified;
         context.SaveChanges();
     }
 }
示例#15
0
 public void UpdateAsiento(Asiento asiento)
 {
     using (context = new BDContext())
     {
         context.Entry(asiento).State = System.Data.Entity.EntityState.Modified;
         context.SaveChanges();
     }
 }
示例#16
0
 public void UpdateSala(Sala sala)
 {
     using (context = new BDContext())
     {
         context.Entry(sala).State = System.Data.Entity.EntityState.Modified;
         context.SaveChanges();
     }
 }
示例#17
0
 public void UpdateClasificacion(Clasificacion clasificacion)
 {
     using (context = new BDContext())
     {
         context.Entry(clasificacion).State = System.Data.Entity.EntityState.Modified;
         context.SaveChanges();
     }
 }
示例#18
0
 public void UpdateCategory(Category category)
 {
     using (var context = new BDContext())
     {
         context.Entry(category).State = System.Data.Entity.EntityState.Modified;
         context.SaveChanges();
     }
 }
示例#19
0
 public void UpdateProveedor(Provedor proveedor)
 {
     using (context = new BDContext())
     {
         context.Entry(proveedor).State = System.Data.Entity.EntityState.Modified;
         context.SaveChanges();
     }
 }
 public void UpdateFactura(Factura factura)
 {
     using (context = new BDContext())
     {
         context.Entry(factura).State = System.Data.Entity.EntityState.Modified;
         context.SaveChanges();
     }
 }
示例#21
0
 public void UpdateUsuario(Users user)
 {
     using (context = new BDContext())
     {
         context.Entry(user).State = System.Data.Entity.EntityState.Modified;
         context.SaveChanges();
     }
 }
示例#22
0
 public void UpdateIntermedia(Intermedia intermedia)
 {
     using (context = new BDContext())
     {
         context.Entry(intermedia).State = System.Data.Entity.EntityState.Modified;
         context.SaveChanges();
     }
 }
示例#23
0
 public ActionResult Edit([Bind(Include = "ID,Nombre,Apellido")] Persona persona)
 {
     if (ModelState.IsValid)
     {
         db.Entry(persona).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(persona));
 }
示例#24
0
 public ActionResult Edit([Bind(Include = "DiaId,DiaDesc")] Dia dia)
 {
     if (ModelState.IsValid)
     {
         db.Entry(dia).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(dia));
 }
示例#25
0
 public ActionResult Edit([Bind(Include = "Id,nombre,compania,empleados")] Subscrip subscrip)
 {
     if (ModelState.IsValid)
     {
         db.Entry(subscrip).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(subscrip));
 }
示例#26
0
        public void SaveProduct(Product product)
        {
            using (var context = new BDContext())
            {
                context.Entry(product.Category).State = System.Data.Entity.EntityState.Unchanged;

                context.Products.Add(product);
                context.SaveChanges();
            }
        }
示例#27
0
        public async Task <object> postUser(Usuarios usuario)
        {
            string token = _getToken();

            if (!string.IsNullOrEmpty(token))
            {
                Usuarios existeUsuario = await _ctx.Usuarios
                                         .FirstOrDefaultAsync(x => x.Correo == usuario.Correo);

                if (existeUsuario == null)
                {
                    usuario.Estatus = true;

                    _ctx.Entry(usuario).State = EntityState.Added;
                    if (_ctx.SaveChanges() > 0)
                    {
                        return(new
                        {
                            usuario.Id,
                            usuario.Usuario,
                            usuario.Correo,
                            usuario.Sexo,
                            usuario.Estatus,
                            fechaCreacion = _ctx.Usuarios.FirstOrDefault(x => x.Correo == usuario.Correo).FechaCreacion
                        });
                    }
                    else
                    {
                        _manager.Deactivate();
                        return(false);
                    }
                }
                else
                {
                    return(false);
                }
            }
            else
            {
                _manager.Deactivate();
                return(false);
            }
        }
示例#28
0
 public ActionResult Edit([Bind(Include = "TipoExercicioId,TipoExercicioDesc")] TipoExercicio tipoExercicio)
 {
     if (ModelState.IsValid)
     {
         db.Entry(tipoExercicio).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(tipoExercicio));
 }
示例#29
0
 public ActionResult Edit([Bind(Include = "UsuarioId,Nome,Idade,Peso,DataCadastro")] Usuario usuario)
 {
     if (ModelState.IsValid)
     {
         db.Entry(usuario).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(usuario));
 }
 public void Update(TEntity entity)
 {
     try
     {
         Context.Entry(entity).State = EntityState.Modified;
     }
     catch (Exception)
     {
         throw;
     }
 }