public async Task <IQueryable <UserProperty> > PutUserProperty(UserPropertyEditRequest request, Guid userId) { var targetType = await dbContext .UserPropertyTypes .SingleOrDefaultAsync(upt => upt.Id == request.Id) ?? throw ResponseStatusCode.NotFound.ToApiException(); var newProperty = mapper.Map <UserProperty>(request); newProperty.Status = targetType.DefaultStatus; newProperty.UserId = userId; await dbContext.AddAsync(newProperty); await dbContext.SaveChangesAsync(); return(dbContext .UserProperties .Where(up => up.Id == newProperty.Id)); }
public async Task <OneObjectResponse <UserPropertyView> > PutAsync( [FromBody] UserPropertyEditRequest request) => await(await userPropertiesManager.PutUserProperty(request, UserId)) .ProjectTo <UserPropertyView>() .SingleAsync();