public async Task <IHttpActionResult> UpdateUser(UserViewModel model) { var foundUser = await _securityServiceAsync.GetUserByIdAsync(model.Id); var mappedUser = Mapper.Map(model, foundUser); await _securityServiceAsync.SaveUserAsync(mappedUser); return(Ok()); }
public async Task <IEnumerable <SearchResultItemViewModel> > SearchItems([FromBody] SearchRequestModel model) { SearchRequest mappedRequest = null; try { mappedRequest = Mapper.Map(model, new SearchRequest()); } catch (Exception e) { throw; } var searchResult = await _searchService.SearchWithFiltersAsync( await _securityService.GetUserByIdAsync(User.Identity.GetUserId()), mappedRequest); var mappedResult = Mapper.Map <IEnumerable <SearchResultItem>, IEnumerable <SearchResultItemViewModel> >(searchResult); return(mappedResult); }
// // GET: /Manage/Details public async Task <ActionResult> Details(ImportErrors?error) { if (error != null) { switch (error) { case ImportErrors.FileFormatError: ViewData["ErrorMessage"] = "Error! You can only import from .zip - archives generated by EASE - tool"; break; } } var user = await _securityService.GetUserByIdAsync(User.Identity.GetUserId <string>()); return(View(Mapper.Map(user, new Models.Manage.UserDetailsViewModel()))); }