// // GET: /Blocos/Delete/5 public ActionResult Delete(int id = 0) { Elencos jogador = db.Elencos.Find(id); if (jogador == null) { return(HttpNotFound()); } return(View(jogador)); }
// // GET: /Blocos/Details/5 public ActionResult Details(int id = 0) { Elencos time = db.Elencos.Find(id); if (time == null) { return(HttpNotFound()); } return(View(time)); }
public ActionResult DeleteConfirmed(int id) { Elencos jogador = db.Elencos.Find(id); jogador.Excluido = true; db.Entry(jogador).State = EntityState.Modified; db.Entry(jogador).Property(x => x.DataCadastro).IsModified = false; db.Entry(jogador).Property(x => x.Ativo).IsModified = false; db.SaveChanges(); GerenciaLogs.saveLog(ref db, WebSecurity.GetUserId(User.Identity.Name), areaADM, TipoAcesso.Exclusao, jogador.Id); return(RedirectToAction("Index", new { timeId = jogador.TimeId })); }
// // GET: /Blocos/Edit/5 public ActionResult Edit(int id = 0) { Elencos jogador = db.Elencos.Find(id); if (jogador == null) { return(HttpNotFound()); } ViewBag.idTime = jogador.TimeId; ViewBag.TimeId = new SelectList(db.Times.Where(a => !a.Excluido && a.Ativo), "Id", "Nome", (jogador.TimeId > 0 ? jogador.TimeId : 0)); return(View(jogador)); }
public ActionResult Edit(Elencos jogador, HttpPostedFileBase FotoUpload) { if (ModelState.IsValid) { jogador.DataCadastro = DateTime.Now; db.Entry(jogador).State = EntityState.Modified; if (db.SaveChanges() > 0) { #region image if (FotoUpload != null) { var path48x48 = Server.MapPath(string.Format(pathFoto130x100, jogador.TimeId)); var path28x28 = Server.MapPath(string.Format(pathFoto70x40, jogador.TimeId)); var fileOriginal = Server.MapPath(string.Format(pathOriginal, jogador.TimeId)); jogador.Foto = Utils.SaveFileBase(fileOriginal, FotoUpload); Utils.resizeImageAndSave3(Path.Combine(fileOriginal, jogador.Foto), 130, 100, path48x48); Utils.resizeImageAndSave3(Path.Combine(fileOriginal, jogador.Foto), 70, 40, path28x28); } #endregion db.Entry(jogador).State = EntityState.Modified; db.SaveChanges(); } GerenciaLogs.saveLog(ref db, WebSecurity.GetUserId(User.Identity.Name), areaADM, TipoAcesso.Edicao, jogador.Id); return(RedirectToAction("Index", new { timeId = jogador.TimeId })); } ViewBag.idTime = jogador.TimeId; ViewBag.TimeId = new SelectList(db.Times.Where(a => !a.Excluido && a.Ativo), "Id", "Nome", (jogador.TimeId > 0 ? jogador.TimeId : 0)); return(View(jogador)); }