public AdvisorDto GetCurrentAdvisor() { if (HttpContext.Current.User.Identity.IsAuthenticated) { FormsIdentity identity = (HttpContext.Current.User.Identity as FormsIdentity); AdvisorDto advisor = AdvisorServices.GetAdvisorByIdentity(HttpContext.Current.User.Identity.Name); return(advisor); } return(null); }
internal AdvisorDto GetAdvisorByIdentity(string identity) { //arrange SIAdvisorRepository advisorRepository = new SIAdvisorRepository(); SIRepository repository = new SIRepository(); IDtoCreator <Advisor, AdvisorDto> advisorDtoCreator = new AdvisorDtoCreator(); advisorRepository.GetAdvisorByIdentityString = (x) => _advisors.SingleOrDefault(a => a.Identification == x); //act AdvisorServices services = new AdvisorServices(repository, advisorRepository, advisorDtoCreator); AdvisorDto result = services.GetAdvisorByIdentity(identity); return(result); }
public async Task <ActionResult <AdvisorDto> > CancelAdvisorAccount(string advisorid) { try { var result = await repo.CancelAdvisorAccount(advisorid); if (result == null) { return(BadRequest("Något hände vid radering")); } var deletedadvisor = new AdvisorDto(); deletedadvisor = mapper.Map <AdvisorDto>(result); return(deletedadvisor); } catch (Exception) { return(StatusCode(500)); } }
public void EndGetCurrentAdvisor(IAsyncResult e) { Advisor = AdvisorService.EndGetCurrentAdvisor(e); }