예제 #1
0
        public async Task <IActionResult> Manage(Guid ApplicationUserId)
        {
            TradeCodeViewModel model = new TradeCodeViewModel();

            model.ApplicationUser = await UserManagerService.FindByIdAsync(ApplicationUserId.ToString());

            model.CurrentTradeCodesAssignedToUser = TradeCodeService.CurrentTradeCodesAssignedToUser(ApplicationUserId);
            ViewBag.TradeCodes = new SelectList(TradeCodeService.AllAvailableTradeCodesByUser(ApplicationUserId), "Id", "TradeType");
            return(View(model));
        }
예제 #2
0
        public async Task <IActionResult> Assign(TradeCodeViewModel model, Guid ApplicationUserId)
        {
            ApplicationUser user = await UserManagerService.FindByIdAsync(ApplicationUserId.ToString());

            TradeCode       tradeCode       = TradeCodeService.ReturnSingleTradeCode(model.TradeCodeToAssign.Id);
            RepairOperative RepairOperative = new RepairOperative
            {
                ApplicationUser = user,
                Id        = Guid.NewGuid(),
                TradeCode = tradeCode
            };

            TradeCodeService.AssignTradeCode(RepairOperative);
            TradeCodeService.SaveChanges();
            return(RedirectToAction("Manage", new { ApplicationUserId = ApplicationUserId }));
        }