public async Task <BalanceNoteViewModel> GetNoteByIdAsync(Guid userId, Guid id) { BalanceNote note = await _balanceNoteRepository.GetByIdAsync(userId, id); BalanceNoteViewModel result = new BalanceNoteViewModel(note); return(result); }
public async Task <BalanceNoteViewModel> GetNoteByEffectiveDateAsync(Guid userId, DateTime effectiveDate) { BalanceNote note = await _balanceNoteRepository.GetByEffectiveDateAsync(userId, effectiveDate); BalanceNoteViewModel result = null; if (note != null) { result = new BalanceNoteViewModel(note); } return(result); }
public async Task <ActionResult <BalanceNoteViewModel> > AlterNoteAsync(DateTime effectiveDate, [FromBody] BalanceNoteUpdateModel note) { UserViewModel user = await GetCurrentUserAsync(); if (user == null) { return(HandleUserNotFoundResult()); } BalanceNoteViewModel result = await _balanceNoteService.AlterNoteAsync(user.Id, effectiveDate, note.Content); return(Ok(result)); }
public async Task <ActionResult <BalanceNoteViewModel> > GetNoteByEffectiveDateAsync(DateTime effectiveDate) { UserViewModel user = await GetCurrentUserAsync(); if (user == null) { return(HandleUserNotFoundResult()); } BalanceNoteViewModel result = await _balanceNoteService.GetNoteByEffectiveDateAsync(user.Id, effectiveDate); return(Ok(result)); }
public async Task <BalanceNoteViewModel> AlterNoteAsync(Guid userId, DateTime effectiveDate, string content) { BalanceNote note = await _balanceNoteRepository.GetByEffectiveDateAsync(userId, effectiveDate); note = note != null ? await _balanceNoteRepository.UpdateAsync(userId, note.Id, content) : await _balanceNoteRepository.CreateAsync(userId, effectiveDate, content); await _unitOfWork.SaveChangesAsync(); BalanceNoteViewModel result = new BalanceNoteViewModel(note); return(result); }