Пример #1
0
        public async Task <ActionResult> Index(Guid id)
        {
            var transitStateCollection = await mediator.SendAsync(new GetDraftData <TransitStateCollection>(id));

            var model = new TransitStateCollectionViewModel
            {
                TransitStates      = (await mediator.SendAsync(new GetTransitStateDataForTransitStates(transitStateCollection.TransitStates.ToList()))).ToList(),
                HasNoTransitStates = transitStateCollection.HasNoTransitStates
            };

            return(View(model));
        }
Пример #2
0
        public async Task <ActionResult> Delete(Guid id, Guid deleteId, TransitStateCollectionViewModel model)
        {
            var transitStateCollection = await mediator.SendAsync(new GetDraftData <TransitStateCollection>(id));

            transitStateCollection.Delete(deleteId);

            await mediator.SendAsync(new SetDraftData <TransitStateCollection>(id, transitStateCollection));

            model.TransitStates.Remove(model.TransitStates.SingleOrDefault(m => m.Id == deleteId));

            return(PartialView("_Table", model));
        }
        public async Task<ActionResult> Index(Guid id)
        {
            var transitStateCollection = await mediator.SendAsync(new GetDraftData<TransitStateCollection>(id));
            
            var model = new TransitStateCollectionViewModel
            {
                TransitStates = (await mediator.SendAsync(new GetTransitStateDataForTransitStates(transitStateCollection.TransitStates.ToList()))).ToList(),
                HasNoTransitStates = transitStateCollection.HasNoTransitStates
            };

            return View(model);
        }
Пример #4
0
        public async Task <ActionResult> Index(Guid id, TransitStateCollectionViewModel model)
        {
            if (!ModelState.IsValid)
            {
                return(View(model));
            }

            var transitStateCollection = await mediator.SendAsync(new GetDraftData <TransitStateCollection>(id));

            transitStateCollection.HasNoTransitStates = model.HasNoTransitStates;

            await mediator.SendAsync(new SetDraftData <TransitStateCollection>(id, transitStateCollection));

            return(RedirectToAction("Index", "Home"));
        }
        public async Task<ActionResult> Index(Guid id, TransitStateCollectionViewModel model)
        {
            if (!ModelState.IsValid)
            {
                return View(model);
            }

            var transitStateCollection = await mediator.SendAsync(new GetDraftData<TransitStateCollection>(id));

            transitStateCollection.HasNoTransitStates = model.HasNoTransitStates;

            await mediator.SendAsync(new SetDraftData<TransitStateCollection>(id, transitStateCollection));

            return RedirectToAction("Index", "Home");
        }
        public async Task<ActionResult> Delete(Guid id, Guid deleteId, TransitStateCollectionViewModel model)
        {
            var transitStateCollection = await mediator.SendAsync(new GetDraftData<TransitStateCollection>(id));

            transitStateCollection.Delete(deleteId);

            await mediator.SendAsync(new SetDraftData<TransitStateCollection>(id, transitStateCollection));

            model.TransitStates.Remove(model.TransitStates.SingleOrDefault(m => m.Id == deleteId));

            return PartialView("_Table", model);
        }