private async Task <CoachRouteWriteDto> AttachUserIdToRecord(CoachRouteWriteDto record)
        {
            var user = await Identity.GetConnectedUserId(httpContext);

            record.UserId = user.UserId;
            return(record);
        }
        public async Task <IActionResult> PutRouteAsync([FromBody] CoachRouteWriteDto record)
        {
            var response = repo.IsValid(record);

            if (response == 200)
            {
                repo.Update(mapper.Map <CoachRouteWriteDto, CoachRoute>(await AttachUserIdToRecord(record)));
                return(StatusCode(200, new {
                    response = ApiMessages.RecordUpdated()
                }));
            }
            else
            {
                return(GetErrorMessage(response));
            }
        }
Exemplo n.º 3
0
 public int IsValid(CoachRouteWriteDto record)
 {
     return(true switch {
         var x when x == !IsValidPort(record) => 450,
         _ => 200,
     });