public ActionResult Actualizar(Factura.Models.users empresaModel) { try { if (ModelState.IsValid) { using (ffeEntities db = new ffeEntities()) { var empresaDetails = db.users.Find(empresaModel.id); if (TryUpdateModel(empresaDetails)) { db.SaveChanges(); } } } return(RedirectToAction("List", "Login")); } catch (Exception e) { if (e.Source != null) { Console.WriteLine("IOException source: {0}", e.Source); } throw; } }
public ActionResult Registrar(Factura.Models.users empresaModel) { try { if (ModelState.IsValid) { using ( ffeEntities db = new ffeEntities()) { DateTime now = DateTime.Now; empresaModel.created_at = now; empresaModel.active = 1; db.users.Add(empresaModel); db.SaveChanges(); } } return(RedirectToAction("List", "Login")); } catch (Exception e) { if (e.Source != null) { Console.WriteLine("IOException source: {0}", e.Source); } throw; } }
public ActionResult Desactivar(int?id) { using ( ffeEntities db = new ffeEntities()) { var empresaDetails = db.users.Find(id); empresaDetails.active = 0; if (TryUpdateModel(empresaDetails)) { db.SaveChanges(); } return(RedirectToAction("List", "Login")); } }