Пример #1
0
 public Centros Edit(Centros model)
 {
     entities.Centros.Attach(model);
       entities.ObjectStateManager.ChangeObjectState(model, EntityState.Modified);
       this.Commit();
       return model;
 }
Пример #2
0
        public void Delete(int id)
        {
            Centros centros = new Centros();
              centros = GetCentroById(id);

              if (centros.appcentrosroles.Count > 0)
            throw new Exception(string.Format("No se puede eliminar el centro {0}, ya que tiene registro relacionados en centros por roles", centros.Nombre));

              entities.Centros.DeleteObject(centros);
              this.Commit();
        }
Пример #3
0
        public ActionResult Create(Centros model, int? id)
        {
            try
              {

            CentrosService.Create(model);

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

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

              }
              catch (Exception ex)
              {
            TempData["ErrorMessage"] = ex.Message;
            return View(model);
              }
        }
Пример #4
0
        public ActionResult Edit(Centros model)
        {
            try
              {

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

              }
              catch (Exception ex)
              {
            TempData["ErrorMessage"] = ex.Message;
            return View(model);
              }
        }
Пример #5
0
 public Centros Create(Centros model)
 {
     entities.Centros.AddObject(model);
       this.Commit();
       return model;
 }
 /// <summary>
 /// Deprecated Method for adding a new object to the Centros EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
 /// </summary>
 public void AddToCentros(Centros centros)
 {
     base.AddObject("Centros", centros);
 }
 /// <summary>
 /// Create a new Centros object.
 /// </summary>
 /// <param name="id_centro">Initial value of the Id_centro property.</param>
 /// <param name="nombre">Initial value of the Nombre property.</param>
 public static Centros CreateCentros(global::System.Int32 id_centro, global::System.String nombre)
 {
     Centros centros = new Centros();
     centros.Id_centro = id_centro;
     centros.Nombre = nombre;
     return centros;
 }