public IHttpActionResult PutPuntuacion(int id, Puntuacion puntuacion)
        {
            if (!ModelState.IsValid || !IsValid(puntuacion))
            {
                return(BadRequest(ModelState));
            }

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

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

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

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

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

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

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

            return(StatusCode(HttpStatusCode.NoContent));
        }
        public IHttpActionResult PutCliente(int id, Cliente cliente)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

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

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

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

            return(StatusCode(HttpStatusCode.NoContent));
        }
Example #4
0
 public bool DeleteDiscoById(int id)
 {
     try
     {
         discosEntities.Entry(SearchDiscoById(id)).State = System.Data.Entity.EntityState.Deleted;
         discosEntities.SaveChanges();
         return(true);
     }
     catch (Exception)
     {
         return(false);
     }
 }
Example #5
0
 public bool CreateCliente(Cliente cliente)
 {
     try
     {
         discosEntities.Clientes.Add(cliente);
         discosEntities.SaveChanges();
         return(true);
     }
     catch (Exception)
     {
         return(false);
     }
 }
Example #6
0
 public bool CreateInterprete(Interprete interprete)
 {
     try
     {
         discosEntities.Interpretes.Add(interprete);
         discosEntities.SaveChanges();
         return(true);
     }
     catch (Exception)
     {
         return(false);
     }
 }
Example #7
0
 public ActionResult CreateDiscografica(Discografica discografica)
 {
     if (ModelState.IsValid)
     {
         var context = new DiscosEntities();
         context.Discograficas.Add(discografica);
         context.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View());
 }