public ActionResult <IngresoViewModel> Get(string IdIngreso) { var ingreso = _ingresoService.BuscarxIdentificacion(IdIngreso); if (ingreso == null) { return(NotFound()); } var ingresoViewModel = new IngresoViewModel(ingreso); return(ingresoViewModel); }
public ActionResult Delete(int id, IngresoViewModel ingresoViewModel) { try { var ingreso = manager.SearchById(id); manager.DeleteIngreso(ingreso); return(RedirectToAction("Index")); } catch { return(View()); } }
public ActionResult Edit(int id, IngresoViewModel ingresoViewModel) { ModelState.Clear(); var fuente = fuenteManager.SearchById(ingresoViewModel.Ingreso.Fuente.Id); ingresoViewModel.Ingreso.Fuente.Nombre = fuente.Nombre; if (!TryValidateModel(ingresoViewModel)) { var list = fuentesDisponibles.Select(f => new SelectListItem() { Text = f.Nombre, Value = f.Id.ToString(), Selected = f.Id == 1 ? true : false }).ToList(); ingresoViewModel.FuentesDisponibles = list; return(View(ingresoViewModel)); } try { manager.UpdateIngreso(id, new IngresoDto() { Id = ingresoViewModel.Ingreso.Id, Monto = (double)ingresoViewModel.Ingreso.Monto, Descripcion = ingresoViewModel.Ingreso.Descripcion, Fuente = new FuenteDto() { Id = ingresoViewModel.Ingreso.Fuente.Id }, Fecha = ingresoViewModel.Ingreso.Fecha }); return(RedirectToAction("Index")); } catch (Exception ex) { ModelState.AddModelError("exception", ex.Message.ToString()); return(View()); } }
public App() { InitializeComponent(); BindingContext = IngresoViewModel.GetInstance(); //MainPage = new LoginPage(); //NavigationPage navigation = new NavigationPage(new HomePage()); //navigation.BarBackgroundColor = Color.FromHex("#3e91a3"); //App.Current.MainPage = new MasterDetailPage //{ // Master = new HomeMenu(), // Detail = navigation, //}; }
public IngresoView() { InitializeComponent(); BindingContext = new IngresoViewModel();//Se le dice que el contexto sera la clase, donde el binding context sera el LoginViewModel }