public ActionResult Create() { var model = new SteersViewModel(); model.StateSelectList = selectList; model.BirthDate = DateTime.Today; return(View(model)); }
public MainWindow(SimulatorViewModel SimulatorVm, SteersViewModel SteersVm, MapViewModel MapVm, DashboardViewModel DashboardVm) { InitializeComponent(); this.Dispatcher.UnhandledException += HandleAllExceptions; this.vm = SimulatorVm; DataContext = vm; Steers.DataContext = SteersVm; Dashboard.DataContext = DashboardVm; Map.DataContext = MapVm; }
private void Application_Startup(object sender, StartupEventArgs e) { IServerModel model = new ServerModel(new SimulatorTelnetClient()); SimulatorViewModel SimulatorVm = new SimulatorViewModel(model); SteersViewModel SteersVm = new SteersViewModel(model); MapViewModel MapVm = new MapViewModel(model); DashboardViewModel DashboardVm = new DashboardViewModel(model); MainWindow window = new MainWindow(SimulatorVm, SteersVm, MapVm, DashboardVm); window.Show(); }
public ActionResult Edit(int id, SteersViewModel model) { model.StateSelectList = selectList; if (ModelState.IsValid) { Cattle steer = mapper.Map <Cattle>(model); steer.Id = id; steer.CattleTypeId = (int)CattleTypes.Steer; db.Repository.Update(steer); db.Commit(); return(RedirectToAction("Index", "Steers")); } return(View(model)); }
public ActionResult Create(SteersViewModel model) { model.StateSelectList = selectList; if (ModelState.IsValid) { Cattle steer = mapper.Map <Cattle>(model); steer.CattleTypeId = (int)CattleTypes.Steer; steer.Sex = (int)Sex.Male; db.Repository.Add(steer); db.Commit(); return(RedirectToAction("Index", "Steers")); } return(View(model)); }