Ejemplo n.º 1
0
        private async Task <ScheduleWriteDto> AttachUserIdToRecordOnUpdateAsync(ScheduleWriteDto record)
        {
            var userId = await Identity.GetConnectedUserId(httpContext);

            record.UserId = userId.UserId;
            return(record);
        }
Ejemplo n.º 2
0
        public async Task <IActionResult> PutScheduleAsync([FromBody] ScheduleWriteDto record)
        {
            var response = repo.IsValidOnUpdate(record);

            if (response == 200)
            {
                repo.Update(mapper.Map <ScheduleWriteDto, Schedule>(await AttachUserIdToRecordOnUpdateAsync(record)));
                return(StatusCode(200, new {
                    response = ApiMessages.RecordUpdated()
                }));
            }
            else
            {
                return(GetErrorMessage(response));
            }
        }