public async Task <ActionResult <ControllerResponse <GetTimeSpend> > > Create(CreateTimeSpend createTimeSpend) { try { string userId = _httpContextAccessor.HttpContext.User.FindFirstValue(ClaimTypes.Name).ToString(); if (null != userId) { TimeSpend timeSpend = _mapper.Map <TimeSpend>(createTimeSpend); timeSpend.UserId = userId; return(new ControllerResponse <GetTimeSpend> { data = await _timeManager.manageTime(timeSpend) }); } else { return(new ControllerResponse <GetTimeSpend> { data = null, message = "UserId error", success = false }); } } catch (System.Exception) { return(new ControllerResponse <GetTimeSpend> { data = null, message = "something went wrong, sorry:(", success = false }); } }