public ActionResult DeleteConfirmed(int id) { ModelEmprestimo modelEmprestimo = db.emprestimo.Find(id); db.emprestimo.Remove(modelEmprestimo); db.SaveChanges(); return(RedirectToAction("Index")); }
public ActionResult Edit([Bind(Include = "idEmprestimo,RA,livro_id,qtd,data_emp,data_devol")] ModelEmprestimo modelEmprestimo) { if (ModelState.IsValid) { db.Entry(modelEmprestimo).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(modelEmprestimo)); }
public ActionResult Create([Bind(Include = "idEmprestimo,RA,livro_id,qtd,data_emp,data_devol")] ModelEmprestimo modelEmprestimo) { if (ModelState.IsValid) { db.emprestimo.Add(modelEmprestimo); db.SaveChanges(); return(RedirectToAction("Index")); } return(View(modelEmprestimo)); }
// GET: ModelEmprestimoes/Delete/5 public ActionResult Delete(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } ModelEmprestimo modelEmprestimo = db.emprestimo.Find(id); if (modelEmprestimo == null) { return(HttpNotFound()); } return(View(modelEmprestimo)); }
public ActionResult Devolucao(int id) { var emprestimo = (_emprestimoService.Get() as IQueryable <Emprestimo>).Where(x => x.JogoId == id && x.Ativo == true).FirstOrDefault(); var amigo = _amigoService.Get(emprestimo.AmigoId); var model = new ModelEmprestimo() { Emprestimo = emprestimo, Amigos = new List <Amigo>() { amigo } }; //var amigo = _jogoService.Get(id); return(View(model)); }
public ActionResult Emprestimo(int id) { ViewBag.Message = "Acessar"; var jogo = _jogoService.Get(id); var emprestimo = new Emprestimo() { JogoId = id, Jogo = jogo }; var model = new ModelEmprestimo() { Emprestimo = emprestimo }; model.Amigos = (_amigoService.Get() as IQueryable <Amigo>).ToList(); return(View(model)); }
public ActionResult Emprestimo(Emprestimo emprestimo) { var retorno = _jogoService.Emprestar(emprestimo); if (retorno != null) { return(Redirect("\\Jogos\\Jogos")); } else { var jogo = _jogoService.Get(emprestimo.JogoId); emprestimo.Jogo = jogo; var model = new ModelEmprestimo() { Emprestimo = emprestimo, }; model.Amigos = (_amigoService.Get() as IQueryable <Amigo>).ToList(); ViewBag.Message = EscopoBase._notificacoes; return(View(model)); } }