public MServico DeleteService(long id) { MServico mServico = ListService(id); context.Servicos.Remove(mServico); context.SaveChanges(); return(mServico); }
//Adicionar usuarios e editar dados public void SaveService(MServico mServico) { if (mServico.ID == 0) { context.Servicos.Add(mServico); } else { context.Entry(mServico).State = EntityState.Modified; } context.SaveChanges(); }
public ActionResult Delete(long id) { try { MServico mServico = sServico.DeleteService(id); TempData["Message"] = "Serviço " + mServico.ID + " foi removido"; return(RedirectToAction("PedidosPendentes")); } catch { return(View()); } }
private ActionResult GetViewServiceToID(long?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } MServico mServico = sServico.ListService((long)id); if (mServico == null) { return(HttpNotFound()); } return(View(mServico)); }
private ActionResult SaveServico(MServico mServico) { try { if (ModelState.IsValid) { sServico.SaveService(mServico); return(RedirectToAction("Index", "Home", new { Area = "Home" })); } return(View(mServico)); } catch { return(View(mServico)); } }
public ActionResult Create(MServico mServico) { return(SaveServico(mServico)); }
public void SaveService(MServico mServico) { serviceDAL.SaveService(mServico); }