/// <summary> /// Invokes view component /// </summary> /// <returns></returns> public IViewComponentResult Invoke() { var account = _currentAccountProvider.GetCurrentAccount(HttpContext.User); var badges = _balanceFacade.ListAchievedAccountBadges(account.Id, MaxNumberOfBadgeRows); var model = _mapper.Map <List <AccountBadgeViewModel> >(badges); return(View(model)); }
/// <summary> /// Invokes view component /// </summary> /// <returns></returns> public IViewComponentResult Invoke() { var account = _currentAccountProvider.GetCurrentAccount(HttpContext.User); var balances = _balanceFacade.GetDailyBalanceGraphData(account.Id); var model = _mapper.Map <List <DayTotalBalanceViewModel> >(balances); return(View(model)); }
/// <summary> /// Invokes componet /// </summary> public IViewComponentResult Invoke([FromQuery] string successMessage = null) { var account = _currentAccountProvider.GetCurrentAccount(HttpContext.User); var model = new InProgressPlansViewModel() { Plans = _mapper.Map <List <PlanViewModel> >(_balanceFacade.ListPlansInProgress(account.Id)) }; return(View(model)); }
public void NoteHasNoteTags() { var note = new Note { Id = 1, Title = "Note 1" }; var noteTags = new List <NoteTag>() { new NoteTag { Id = 1, NoteId = 1, TagId = 1, Tag = new Tag { Id = 1, Title = "Tag 1" }, }, new NoteTag { Id = 1, NoteId = 1, TagId = 2, Tag = new Tag { Id = 2, Title = "Tag 2" }, } }; note.NoteTags = noteTags; NoteDto dto = _mapper.Map <Note, NoteDto>(note); Assert.True(dto.NoteTags.Count == 2); Assert.Contains(dto.NoteTags, ntd => ntd.NoteId == 1 && ntd.TagId == 1 && ntd.Title == "Tag 1"); Assert.Contains(dto.NoteTags, ntd => ntd.NoteId == 1 && ntd.TagId == 2 && ntd.Title == "Tag 2"); }
public async Task <IHttpActionResult> Register([FromBody] RegisterViewModel model) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } var userDto = _mapper.Map <UserDTO>(model); var result = await _userService.CreateUser(userDto); return(GetResult(result)); }
/// <summary> /// Gets the detail for an entity with the specified ID. /// </summary> internal virtual T GetDetail(TKey id) { var entity = Repository.GetById(id, EntityIncludes); return(ExpenseManagerMapper.Map <TEntity, T>(entity)); }