public async Task <ActionResult <GoalViewModel> > PutDay(Guid id, [FromBody] GoalViewModel goalViewModel) { if (id != goalViewModel.Id) { return(BadRequest()); } var goalYearPrevious = await _goalDayService.Update(goalViewModel.ToDayDb()); return(goalYearPrevious.ToViewModel()); }
public async Task <ActionResult <GoalViewModel> > PostDay([FromBody] GoalViewModel goalViewModel) { var userGuid = GetUserId(); if (!userGuid.HasValue) { return(Forbid()); } goalViewModel.OwnerId = userGuid.Value; var entry = await _goalDayService.Add(goalViewModel.ToDayDb()); return(CreatedAtAction(nameof(GetByIdYear), new { id = entry.Id }, entry)); }