コード例 #1
0
        public async Task <IHttpActionResult> ChangeImageAsync([FromBody] ChangeImageRequest request)
        {
            User user = await GetCurrentUserAsync() ?? throw new ActionForbiddenException();

            await _profileService.ChangeImageAsync(user, request.Id);

            await UnitOfWork.SaveChangesAsync();

            return(Ok());
        }
コード例 #2
0
 public int ChangeImage(ChangeImageRequest request)
 {
     using (SqlConnection connection = new SqlConnection(_connectionString))
     {
         var queryString = @"Update [User]
                                 Set ProfilePic = @ProfilePic
                             Output inserted.Id
                             Where [User].Id = @Id";
         var imgUpdate   = connection.QueryFirst <int>(queryString, request);
         return(imgUpdate);
     }
     throw new Exception("Could not change image");
 }
コード例 #3
0
        public ActionResult ChangeImage(ChangeImageRequest request)
        {
            var imgUpdate = _connection.ChangeImage(request);

            return(Accepted(imgUpdate));
        }