public ActionResult Registro(UsuarioDelegadoVM vm) { if (!ModelState.IsValid || EmailYaEstaEnUso(vm.Usuario)) { vm.ClubsParaCombo = ClubsParaCombo(); return(View(vm)); } var model = new UsuarioDelegado(); VMM.MapForCreate(vm, model); Context.UsuariosDelegados.Add(model); Context.SaveChanges(); return(View("RegistroExitoso")); }
public override ActionResult Create(FechaVM vm) { if (!ModelState.IsValid || HayInconsistencia(vm)) { return(RedirectToAction("Create", new { parentId = vm.ZonaId })); } var model = new Fecha(); VMM.MapForCreate(vm, model); Context.Fechas.Add(model); Context.SaveChanges(); return(RedirectTo("Index", vm.ZonaId)); }
public override ActionResult Create(PagoVM vm) { if (!ModelState.IsValid || ImporteSuperaSaldoDeudor(vm)) { return(RedirectTo("Create", GetParentId(vm))); } var model = new Pago(); VMM.MapForCreate(vm, model); Context.Pagos.Add(model); Context.SaveChanges(); return(RedirectToAction("Details", "MovimientoEntradaConClub", new { id = vm.MovimientoEntradaConClubId })); }
public override ActionResult Create(NoticiaVM viewModel) { if (!ModelState.IsValid) { return(RedirectToAction("Create")); } var model = new Noticia(); VMM.MapForCreate(viewModel, model); Context.Noticias.Add(model); Context.SaveChanges(); return(RedirectToAction("Index")); }
public override ActionResult Create(MovimientoEntradaConClubVM conClubVM) { if (!ModelState.IsValid) { return(RedirectToAction($"CreateMovimiento{conClubVM.Tipo}", new { clubId = conClubVM.ClubId })); } var model = new MovimientoEntradaConClub(); VMM.MapForCreate(conClubVM, model); Context.MovimientosEntradaConClub.Add(model); Context.SaveChanges(); var movimientoCreado = Context.MovimientosEntradaConClub.Local.First(); return(RedirectToAction("Create", "Pago", new { parentId = movimientoCreado.Id })); }
public ActionResult CreateMovimientoInsumo(MovimientoEntradaConClubVM conClubVM) { if (!ModelState.IsValid) { return(RedirectToAction("CreateMovimientoInsumo", new { clubId = conClubVM.ClubId })); } var model = new MovimientoEntradaConClub(); VMM.MapForCreate(conClubVM, model); Context.MovimientosEntradaConClub.Add(model); var conceptoInsumo = Context.ConceptosInsumo.Single(x => x.Id == conClubVM.ConceptoId); conceptoInsumo.DecrementarStock(conClubVM.Cantidad); Context.SaveChanges(); var movimientoCreado = Context.MovimientosEntradaConClub.Local.First(); return(RedirectToAction("Create", "Pago", new { parentId = movimientoCreado.Id })); }