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)); }
public bool DeleteDiscoById(int id) { try { discosEntities.Entry(SearchDiscoById(id)).State = System.Data.Entity.EntityState.Deleted; discosEntities.SaveChanges(); return(true); } catch (Exception) { return(false); } }
public bool CreateCliente(Cliente cliente) { try { discosEntities.Clientes.Add(cliente); discosEntities.SaveChanges(); return(true); } catch (Exception) { return(false); } }
public bool CreateInterprete(Interprete interprete) { try { discosEntities.Interpretes.Add(interprete); discosEntities.SaveChanges(); return(true); } catch (Exception) { return(false); } }
public ActionResult CreateDiscografica(Discografica discografica) { if (ModelState.IsValid) { var context = new DiscosEntities(); context.Discograficas.Add(discografica); context.SaveChanges(); return(RedirectToAction("Index")); } return(View()); }