public IActionResult UnAssign(Guid RepairOperativeId, Guid ApplicationUserId) { RepairOperative repairOperative = TradeCodeService.ReturnSingleRepairOperative(RepairOperativeId); TradeCodeService.UnAssignTradeCode(repairOperative); TradeCodeService.SaveChanges(); return(RedirectToAction("Manage", new { ApplicationUserId = ApplicationUserId })); }
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 })); }
public RepairOperative UnAssignTradeCode(RepairOperative RepairOperative) { db.RepairOperatives.Remove(RepairOperative); return(RepairOperative); }
public RepairOperative AssignTradeCode(RepairOperative RepairOperative) { db.RepairOperatives.Add(RepairOperative); return(RepairOperative); }