예제 #1
0
        public MServico DeleteService(long id)
        {
            MServico mServico = ListService(id);

            context.Servicos.Remove(mServico);
            context.SaveChanges();
            return(mServico);
        }
예제 #2
0
 //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();
 }
예제 #3
0
 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());
     }
 }
예제 #4
0
        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));
        }
예제 #5
0
 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));
     }
 }
예제 #6
0
 public ActionResult Create(MServico mServico)
 {
     return(SaveServico(mServico));
 }
예제 #7
0
파일: SServico.cs 프로젝트: jorelrx/InkWeb
 public void SaveService(MServico mServico)
 {
     serviceDAL.SaveService(mServico);
 }