/// <summary> /// Function to remove user role in competition /// </summary> /// <param name="m"></param> /// <returns></returns> public async Task RemoveRole(ManagesCompetition m) { //TODO: Return something to confirm await _repo.RemoveRoleAsync(m); return; }
/// <summary> /// Function to add role to a user so the user can manage competition /// </summary> /// <param name="m"></param> /// <returns>Newly created role</returns> public async Task <ManagesCompetition> AddRole(ManagesCompetition m) { //TODO: Check if role exists await _repo.AddRoleAsync(m); return(m); }
/// <summary> /// Function to get the role af a user in competition /// </summary> /// <param name="userId"></param> /// <param name="competitionId"></param> /// <returns>Role of the user in given competition</returns> public Role GetRole(string userId, int competitionId) { IEnumerable <ManagesCompetition> m = _repo.GetRolesForUser(userId); ManagesCompetition r = (from x in m where x.CompetitionId.Equals(competitionId) select x).SingleOrDefault(); return(r.Role); }
public IActionResult AddRole(ManagesCompetition m, int competitionId, string userId) { if (ModelState.IsValid) { var task = _competitionService.AddRole(m); task.Wait(); return(RedirectToAction("Personnel", "Admin", new { competitionId = m.CompetitionId })); } return(View()); }
public async Task <IActionResult> DeleteConfirmedManager(ManagesCompetitionViewModel model, int competitionId, string userId) { var entity = new ManagesCompetition { CompetitionId = model.CompetitionId, UserId = model.UserId, Role = model.Role }; await _competitionService.RemoveRole(entity); return(RedirectToAction("Personnel", "Admin", new { competitionId = model.CompetitionId })); }
public async Task <IActionResult> EditManager(ManagesCompetitionViewModel model, int competitionId, string userId) { if (ModelState.IsValid) { var entity = new ManagesCompetition { CompetitionId = model.CompetitionId, UserId = model.UserId, Role = model.Role }; await _competitionService.EditRole(entity); return(RedirectToAction("Personnel", "Admin", new { competitionId = model.CompetitionId })); } return(View(model)); }
public async Task RemoveRoleAsync(ManagesCompetition m) { _context.ManagesCompetitions.Remove(m); await _context.SaveChangesAsync(); }
public void RemoveRole(ManagesCompetition m) { _context.ManagesCompetitions.Remove(m); _context.SaveChanges(); }
public async Task EditRoleAsync(ManagesCompetition m) { _context.ManagesCompetitions.Update(m); await _context.SaveChangesAsync(); }
public void EditRole(ManagesCompetition m) { _context.ManagesCompetitions.Update(m); _context.SaveChanges(); }
public async Task AddRoleAsync(ManagesCompetition m) { await _context.ManagesCompetitions.AddAsync(m); await _context.SaveChangesAsync(); }
public void AddRole(ManagesCompetition m) { _context.ManagesCompetitions.Add(m); _context.SaveChanges(); }
/// <summary> /// Function to edit user role in competition /// </summary> /// <param name="m"></param> /// <returns>Edited role</returns> public async Task <ManagesCompetition> EditRole(ManagesCompetition m) { await _repo.EditRoleAsync(m); return(m); }