public ActionResult Create(Sectores model, int? id)
        {
            try
              {

            SectoresService.Create(model);

            if (id != null)
              ViewData["IdCentro"] = id;

            return RedirectToAction("Index", "Sectores", id);

              }
              catch (Exception ex)
              {
            TempData["ErrorMessage"] = ex.Message;
            return View(model);
              }
        }
        public ActionResult Edit(Sectores model)
        {
            try
              {

              SectoresService.Edit(model);
              return RedirectToAction("Index", new { id = model.Id_empresa });

              }
              catch (Exception ex)
              {
            TempData["ErrorMessage"] = ex.Message;
            return View(model);
              }
        }
 /// <summary>
 /// Create a new Sectores object.
 /// </summary>
 /// <param name="id_sector">Initial value of the Id_sector property.</param>
 public static Sectores CreateSectores(global::System.Int32 id_sector)
 {
     Sectores sectores = new Sectores();
     sectores.Id_sector = id_sector;
     return sectores;
 }
        public ActionResult Index(Sectores model)
        {
            if (!BioTecnal.Models.ApplicationModelRepositoy.validateOptionByRole(User.Identity.Name, "Sectores"))
              {
            TempData["ErrorMessage"] = string.Format("Acceso denegado a {0}", "Sectores");
            return RedirectToAction("Error", "Shared");
              }
              string user = this.User.Identity.Name;

              return PartialView("_Index", SectoresService.GetAllSectores(user));
        }
 /// <summary>
 /// Deprecated Method for adding a new object to the Sectores EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
 /// </summary>
 public void AddToSectores(Sectores sectores)
 {
     base.AddObject("Sectores", sectores);
 }