public ActionResult Edit([Bind(Include = "Id,Nome,Ativo")] TipoEntregaSet tipoEntregaSet) { if (ModelState.IsValid) { tipoEntregaRepository.Atualizar(tipoEntregaSet); return RedirectToAction("Index"); } return View(tipoEntregaSet); }
// GET: TipoEntrega/Delete/5 public ActionResult Delete(int? id) { if (id == null) { return new HttpStatusCodeResult(HttpStatusCode.BadRequest); } TipoEntregaSet tipoEntregaSet = tipoEntregaRepository.ObterPorId(id.Value); if (tipoEntregaSet == null) { return HttpNotFound(); } return View(tipoEntregaSet); }
public void Inserir(TipoEntregaSet entity) { try { if (entity != null) { dbcontext.TipoEntregaSet.Add(entity); dbcontext.Entry(entity).State = System.Data.Entity.EntityState.Added; dbcontext.SaveChanges(); } } catch (Exception ex) { logger.Error(ex); } }
public void Apagar(TipoEntregaSet entity) { try { if (entity != null) { dbcontext.Entry(entity).State = System.Data.Entity.EntityState.Deleted; dbcontext.TipoEntregaSet.Remove(entity); dbcontext.SaveChanges(); } } catch (Exception ex) { logger.Error(ex); } }
public ActionResult DeleteConfirmed(int id) { TipoEntregaSet tipoEntregaSet = tipoEntregaRepository.ObterPorId(id); tipoEntregaRepository.Apagar(tipoEntregaSet); return RedirectToAction("Index"); }