Exemplo n.º 1
0
 public string excluirSecaoProblema(SecaoProblema s)
 {
     string erro = null;
     try
     {
         db.SecaoProblema.DeleteObject(s);
         db.SaveChanges();
     }
     catch (Exception ex)
     {
         erro = ex.Message;
     }
     return erro;
 }
Exemplo n.º 2
0
 public ActionResult Edit(int id)
 {
     if (Roles.IsUserInRole(User.Identity.Name, "administrador") || (System.Web.Security.Roles.IsUserInRole(User.Identity.Name, "gerencia")))
     {
         SecaoProblema s = new SecaoProblema();
         ViewBag.Titulo = "Novo SecaoProblema";
         if (id != 0)
         {
             s = secaoProblemaModel.obterSecaoProblema(id);
             ViewBag.Titulo = "Editar SecaoProblema";
         }
         return View(s);
     }
     return Redirect("/Shared/Error");
 }
Exemplo n.º 3
0
 public ActionResult Edit(SecaoProblema s)
 {
     string erro = null;
     if (s.IdSecao == 0)
         erro = secaoProblemaModel.adicionarSecaoProblema(s);
     else
         erro = secaoProblemaModel.editarSecaoProblema(s);
     if (erro == null)
     {
         return RedirectToAction("Index");
     }
     else
     {
         ViewBag.Erro = erro;
         return View(s);
     }
 }
Exemplo n.º 4
0
 public string editarSecaoProblema(SecaoProblema s)
 {
     string erro = null;
     try
     {
         if (s.EntityState == System.Data.EntityState.Detached)
         {
             db.SecaoProblema.Attach(s);
         }
         db.ObjectStateManager.ChangeObjectState(s, System.Data.EntityState.Modified);
         db.SaveChanges();
     }
     catch (Exception ex)
     {
         erro = ex.Message;
     }
     return erro;
 }
Exemplo n.º 5
0
 /// <summary>
 /// Deprecated Method for adding a new object to the SecaoProblema EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
 /// </summary>
 public void AddToSecaoProblema(SecaoProblema secaoProblema)
 {
     base.AddObject("SecaoProblema", secaoProblema);
 }
Exemplo n.º 6
0
 /// <summary>
 /// Create a new SecaoProblema object.
 /// </summary>
 /// <param name="idSecao">Initial value of the IdSecao property.</param>
 /// <param name="descricao">Initial value of the Descricao property.</param>
 public static SecaoProblema CreateSecaoProblema(global::System.Int32 idSecao, global::System.String descricao)
 {
     SecaoProblema secaoProblema = new SecaoProblema();
     secaoProblema.IdSecao = idSecao;
     secaoProblema.Descricao = descricao;
     return secaoProblema;
 }