public async Task <IActionResult> ClientList() { var response = await _eventiApi.GetClientAsync(); var model = response.Content.Data .Select ( i => new ClientVM { ID = i.ID, FirstName = i.FirstName, LastName = i.LastName, Username = i.Username, Email = i.Email, PhoneNumber = i.PhoneNumber, Address = i.Address } ) .ToList(); return(View(model)); }
public async Task <IActionResult> EventDetails(int EventID, int ClientID) { if (EventID == 0 || ClientID == 0) { return(RedirectToAction("Index")); } var account = await HttpContext.GetLoggedInUser(); var clientResponse = await _eventiApi.GetClientAsync(new ClientSearchRequest() { AccountID = account.ID }); var Client = clientResponse.Content.Data.ToList()[0]; var eventResponse = await _eventiApi.GetEventAsync(EventID); var Event = eventResponse.Content; EventClientVM model = new EventClientVM { EventID = Event.ID, Name = Event.Name, Category = Event.EventCategory.ToString(), Description = Event.Description, Start = Event.Start, End = Event.End, Image = Event.Image, ClientID = Client.ID, ClientFirstName = Client.FirstName, ClientLastName = Client.LastName, ClientAddress = Client.Address }; return(View(model)); }
private async Task <IActionResult> HandleClientLogin(int accountID) { var response = await _eventiApi.GetClientAsync(new ClientSearchRequest() { AccountID = accountID }); var client = response.Content.Data.ToList()[0]; var account = _mapper.Map <Account>(client); HttpContext.SetLoggedInUser(account); return(Redirect("/Client/Korisnik/Index")); }
public async Task <IActionResult> Index(int page = 1) { var account = await HttpContext.GetLoggedInUser(); if (account != null) { var clientResponse = await _eventiApi.GetClientAsync(new ClientSearchRequest() { AccountID = account.ID }); var Client = clientResponse.Content.Data.ToList()[0]; var eventResponse = await _eventiApi.GetClientEvents(Client.ID); var events = eventResponse.Content; var model = new VisitedEventsVM() { Events = eventResponse.Content .Select ( i => new VisitedEventsVM.Row { EventID = i.ID, Category = i.EventCategory.ToString(), Name = i.Name, Image = i.Image, Start = i.Start, End = i.End } ) .ToList() }; return(View(model)); } return(Redirect("/Client/Client/Index")); }