public async Task <IActionResult> Points(Guid userId, [FromBody] PointsUpdateModel model) { var response = await _service.UpdatePointsAsync(userId, model); if (!response.IsSuccessful) { return(ProcessResponse(response)); } await _service.SaveChangesAsync(); return(ProcessResponse(response)); }
public async Task <IResponse> UpdatePointsAsync(Guid userId, PointsUpdateModel model) { if (userId == default) { return(new Response(HttpStatusCode.BadRequest, false, $"Invalid user")); } var user = await _repository.GetByIdAsync(userId); user.Points = model.Points; await _repository.SaveAsync(user); return(new Response(HttpStatusCode.OK, true)); }
public async Task <IActionResult> Points(Guid userId, [FromBody] PointsUpdateModel model) { await _usersService.Points(userId, model); return(Ok()); }