public ActionResult Edit(VotosRestaurante votosrestaurante) { if (ModelState.IsValid) { db.VotosRestaurantes.Attach(votosrestaurante); db.ObjectStateManager.ChangeObjectState(votosrestaurante, EntityState.Modified); db.SaveChanges(); return RedirectToAction("Index"); } ViewBag.IdRestaurante = new SelectList(db.Restaurantes, "Id", "Nombre", votosrestaurante.IdRestaurante); ViewBag.IdUsuario = new SelectList(db.Usuarios, "Id", "Email", votosrestaurante.IdUsuario); return View(votosrestaurante); }
public ActionResult Create(VotosRestaurante votosrestaurante) { votosrestaurante.FechaCreacion = DateTime.Now; if (ModelState.IsValid) { db.VotosRestaurantes.AddObject(votosrestaurante); db.SaveChanges(); return RedirectToAction("Index"); } ViewBag.IdRestaurante = new SelectList(db.Restaurantes, "Id", "Nombre", votosrestaurante.IdRestaurante); ViewBag.IdUsuario = new SelectList(db.Usuarios, "Id", "Email", votosrestaurante.IdUsuario); return View(votosrestaurante); }
/// <summary> /// Deprecated Method for adding a new object to the VotosRestaurantes EntitySet. Consider using the .Add method of the associated ObjectSet<T> property instead. /// </summary> public void AddToVotosRestaurantes(VotosRestaurante votosRestaurante) { base.AddObject("VotosRestaurantes", votosRestaurante); }
/// <summary> /// Create a new VotosRestaurante object. /// </summary> /// <param name="id">Initial value of the Id property.</param> /// <param name="idUsuario">Initial value of the IdUsuario property.</param> /// <param name="idRestaurante">Initial value of the IdRestaurante property.</param> /// <param name="voto">Initial value of the Voto property.</param> /// <param name="comentario">Initial value of the Comentario property.</param> /// <param name="fechaCreacion">Initial value of the FechaCreacion property.</param> public static VotosRestaurante CreateVotosRestaurante(global::System.Int32 id, global::System.Int32 idUsuario, global::System.Int32 idRestaurante, global::System.Int32 voto, global::System.String comentario, global::System.DateTime fechaCreacion) { VotosRestaurante votosRestaurante = new VotosRestaurante(); votosRestaurante.Id = id; votosRestaurante.IdUsuario = idUsuario; votosRestaurante.IdRestaurante = idRestaurante; votosRestaurante.Voto = voto; votosRestaurante.Comentario = comentario; votosRestaurante.FechaCreacion = fechaCreacion; return votosRestaurante; }