public IHttpActionResult PutPaginacion(int id, Paginacion paginacion)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

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

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

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

            return(StatusCode(HttpStatusCode.NoContent));
        }
        public IHttpActionResult PutAspNetUserRoles(string id, AspNetUserRoles aspNetUserRoles)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

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

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

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

            return(StatusCode(HttpStatusCode.NoContent));
        }
        public IHttpActionResult PutCategoriasNoticias(int id, CategoriasNoticias categoriasNoticias)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

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

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

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

            return(StatusCode(HttpStatusCode.NoContent));
        }
Пример #4
0
        public IHttpActionResult PutEstados(int id, Estados estados)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

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

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

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

            return(StatusCode(HttpStatusCode.NoContent));
        }
Пример #5
0
        public void Edit(User entity)
        {
            var originalEntity = context.Users.Find(entity.UserId);

            context.Entry(originalEntity).CurrentValues.SetValues(entity);
        }
        public void Edit(Comment entity)
        {
            var originalEntity = context.Comments.Find(entity.CommentId);

            context.Entry(originalEntity).CurrentValues.SetValues(entity);
        }
        public void Edit(Article entity)
        {
            var originalEntity = context.Articles.Find(entity.ArticleId);

            context.Entry(originalEntity).CurrentValues.SetValues(entity);
        }
Пример #8
0
        public void Edit(Category entity)
        {
            var originalEntity = context.Categorys.Find(entity.CategoryId);

            context.Entry(originalEntity).CurrentValues.SetValues(entity);
        }
Пример #9
0
 public void Update(T entity)
 {
     _context.Entry(entity).State = EntityState.Modified;
     Save();
 }